www.gusucode.com > map 案例源码 matlab代码程序 > map/ChangeProjectionResettingFrameLimitsExample.m

    %% Change Projection Resetting Frame Limits
% This example shows how to switch from one projection to another and reset
% the origin and frame limits, especially when mapping a small portion of
% the Earth.
%%
% Construct an empty map axes for a region of the United States in the
% Lambert Conformal Conic projection (the default projection for the
% |usamap| function).

% Copyright 2015 The MathWorks, Inc.

latlim = [32 42];
lonlim = [-125 -111];
h = usamap(latlim, lonlim);
%%
% Read the |usastatehi| shapefile and return a subset of the shapefile
% contents, as defined by the latitude and longitude limits. The
% |shaperead| function returns the data in a structure called |states| .
states = shaperead('usastatehi', 'UseGeoCoords', true, ...
   'BoundingBox', [lonlim', latlim']);
%%
% Save the latitude and longitude data from the structure in the vectors
% |lat| and |lon| . 
lat = [states.Lat];
lon = [states.Lon];
%%
% Project patch objects on the map axes.
patchm(lat, lon, [0.5 0.5 1])
%%
% Change the projection to Lambert Equal Area Azimuthal and reset the
% origin and frame limits.
setm(gca,'MapProjection','eqaazim','Origin',[37 -118], ...
   'FLatLimit',[-Inf 6]) 
setm(gca,'mlinelocation',2,'plinelocation',2)
tightmap