worldmap.docx
《worldmap.docx》由会员分享,可在线阅读,更多相关《worldmap.docx(23页珍藏版)》请在冰豆网上搜索。
worldmap
worldmap
Constructmapaxesforgivenregionofworld
Syntax
worldmapregion
worldmap(region)
worldmap
worldmap(latlim,lonlim)
worldmap(Z,R)
h=worldmap(...)
Description
worldmapregionorworldmap(region)setsupanemptymapaxeswithprojectionandlimitssuitabletothepartoftheworldspecifiedinregion.regioncanbeastringoracellarrayofstrings.Permissiblestringsincludenamesofcontinents,countries,andislandsaswellas'World','NorthPole','SouthPole',and'Pacific'.
worldmapwithnoargumentspresentsamenufromwhichyoucanselectthenameofasinglecontinent,country,island,orregion.
worldmap(latlim,lonlim)allowsyoutodefineacustomgeographicregionintermsofitslatitudeandlongitudelimitsindegrees.latlimandlonlimaretwo-elementvectorsoftheform[southern_limitnorthern_limit]and[western_limiteastern_limit],respectively.
worldmap(Z,R)derivesthemaplimitsfromtheextentofaregulardatagridgeoreferencedbyR.Riseithera1-by-3vectorcontainingelements:
[cells/degreenorthern_latitude_limitwestern_longitude_limit]
ora3-by-2referencingmatrixthattransformsrasterrowandcolumnindicesto/fromgeographiccoordinatesaccordingto:
[lonlat]=[rowcol1]*R
IfRisareferencingmatrix,itmustdefinea(non-rotational,non-skewed)relationshipinwhicheachcolumnofthedatagridfallsalongameridianandeachrowfallsalongaparallel.
h=worldmap(...)returnsthehandleofthemapaxes.
Forcylindricalprojections,worldmapusestightmapsettheaxislimitstightaroundthemap.Ifyouchangetheprojection,orjustwantmorewhitespacearoundthemapframe,usetightmapagainoraxisauto.
Examples
Example1
Setupaworldmapanddrawcoarsecoastlines:
worldmap('World')
loadcoast
plotm(lat,long)
Example2
Setupworldmapwithlandareas,majorlakesandrivers,andcitiesandpopulatedplaces:
ax=worldmap('World');
setm(ax,'Origin',[01800])
land=shaperead('landareas','UseGeoCoords',true);
geoshow(ax,land,'FaceColor',[0.50.70.5])
lakes=shaperead('worldlakes','UseGeoCoords',true);
geoshow(lakes,'FaceColor','blue')
rivers=shaperead('worldrivers','UseGeoCoords',true);
geoshow(rivers,'Color','blue')
cities=shaperead('worldcities','UseGeoCoords',true);
geoshow(cities,'Marker','.','Color','red')
Example3
DrawamapofAntarctica:
worldmap('antarctica')
antarctica=shaperead('landareas','UseGeoCoords',true,...
'Selector',{@(name)strcmp(name,'Antarctica'),'Name'});
patchm(antarctica.Lat,antarctica.Lon,[0.510.5])
Example4
DrawamapofAfricaandIndiawithmajorcitiesandpopulatedplaces:
worldmap({'Africa','India'})
land=shaperead('landareas.shp','UseGeoCoords',true);
geoshow(land,'FaceColor',[0.150.50.15])
cities=shaperead('worldcities','UseGeoCoords',true);
geoshow(cities,'Marker','.','Color','red')
Example5
MakeamapofthegeoidoverSouthAmericaandthecentralPacific:
worldmap([-5050],[160-30])
loadgeoid
geoshow(geoid,geoidrefvec,'DisplayType','texturemap');
loadcoast
geoshow(lat,long)
Example6
DrawamapofterrainelevationsinKorea:
loadkorea
h=worldmap(map,refvec);
set(h,'Visible','off')
geoshow(h,map,refvec,'DisplayType','texturemap')
colormap(demcmap(map))
Example7
MakeamapoftheUnitedStatesofAmerica,coloringstatepolygons:
ax=worldmap('USA');
loadcoast
geoshow(ax,lat,long,...
'DisplayType','polygon','FaceColor',[.45.60.30])
states=shaperead('usastatelo','UseGeoCoords',true);
faceColors=makesymbolspec('Polygon',...
{'INDEX',[1numel(states)],'FaceColor',...
polcmap(numel(states))});%NOTE-colorsarerandom
geoshow(ax,states,'DisplayType','polygon',...
'SymbolSpec',faceColors)
Example8
韩国朝鲜地图
loadkorea
h=worldmap(map,refvec);
set(h,'Visible','off')
geoshow(h,map,refvec,'DisplayType','texturemap')
colormap(demcmap(map))
usamap
ConstructmapaxesforUnitedStatesofAmerica
Syntax
usamapstate
usamap(state)
usamap'conus'
usamap('conus')
usamap
usamap(latlim,lonlim)
usamap(Z,R)
h=usamap(...)
h=usamap('all')
h=usamap('allequal')
Description
usamapstateorusamap(state)constructsanemptymapaxeswithaLambertConformalConicprojectionandmaplimitscoveringaU.S.stateorgroupofstatesspecifiedbyinputstate.statemaybeastringoracellarrayofstrings,whereeachstringcontainsthenameofastateor'DistrictofColumbia'.Alternatively,statemaybeastandardtwo-letterU.S.PostalServiceabbreviation.Themapaxesiscreatedinthecurrentaxesandtheaxislimitsaresettightaroundthemapframe.
usamap'conus'orusamap('conus')constructsanemptymapaxesfortheconterminous48states(i.e.excludingAlaskaandHawaii).
usamapwithnoargumentsasksyoutochoosefromamenuofstatenamesplus'DistrictofColumbia','conus','all',and'allequal'.
usamap(latlim,lonlim)constructsanemptyLambertConformalmapaxesforaregionoftheU.S.definedbyitslatitudeandlongitudelimitsindegrees.latlimandlonlimaretwo-elementvectorsoftheform[southern_limitnorthern_limit]and[western_limiteastern_limit],respectively.
usamap(Z,R)derivesthemaplimitsfromtheextentofaregulardatagridgeoreferencedbyR.Riseithera1-by-3vectorcontainingelements:
[cells/degreenorthern_latitude_limitwestern_longitude_limit]
ora3-by-2referencingmatrixthattransformsrasterrowandcolumnindicesto/fromgeographiccoordinatesaccordingto:
[lonlat]=[rowcol1]*R
IfRisareferencingmatrix,itmustdefinea(non-rotational,non-skewed)relationshipinwhicheachcolumnofthedatagridfallsalongameridianandeachrowfallsalongaparallel.
h=usamap(...)returnsthehandleofthemapaxes.
h=usamap('all')constructsthreeemptyaxes,insetwithinasinglefigure,fortheconterminousstates,Alaska,andHawaii,respectively,usingprojectionparameterssuggestedbytheU.S.GeologicalSurvey.Thehandlesforthethreemapaxesarereturnedinh.h
(1)isfortheconterminousstates,h
(2)isforAlaska,andh(3)isforHawaii.
h=usamap('allequal')constructsthemapaxeswithAlaskaandHawaiiatthesamescaleastheconterminousstates.
Remarks
usamapusestightmapsettheaxislimitstightaroundthemap.Ifyouchangetheprojection,orjustwantmorewhitespacearoundthemapframe,usetightmapagainoraxisauto.
axes(h(n)),wheren=1,2,or3,makesthedesiredaxescurrent.
set(h,'Visible','on')makestheaxesvisible.
set(h,'ButtonDownFcn','selectmoveresize')allowsinteractiverepositioningoftheaxes.set(h,'ButtonDownFcn','uimaptbx')restorestheMappingToolboxinterfaces.
axesscale(h
(1))resizestheaxescontainingAlaskaandHawaiitothesamescaleastheconterminousstates.
Examples
Example1
MakeamapofAlabamaonly:
usamap('Alabama')
alabamahi=shaperead('usastatehi','UseGeoCoords',true,...
'Selector',{@(name)strcmpi(name,'Alabama'),'Name'});
geoshow(alabamahi,'FaceColor',[0.31.0,0.675])
textm(alabamahi.LabelLat,alabamahi.LabelLon,alabamahi.Name,...
'HorizontalAlignment','center')
Example2
MaparegionextendingfromCaliforniatoMontana:
figure;ax=usamap({'CA','MT'});
set(ax,'Visible','off')
latlim=getm(ax,'MapLatLimit');
lonlim=getm(ax,'MapLonLimit');
states=shaperead('usastatehi',...
'UseGeoCoords',true,'BoundingBox',[lonlim',latlim']);
geoshow(ax,states,'FaceColor',[0.50.51])
lat=[states.LabelLat];
lon=[states.LabelLon];
tf=ingeoquad(lat,lon,latlim,lonlim);
textm(lat(tf),lon(tf),{states(tf).Name},...
'HorizontalAlignment','center')
Example3
MaptheConterminousUnitedStateswithadifferentfillcolorforeachstate:
figure;ax=usamap('conus');
states=shaperead('usastatelo','UseGeoCoords',true,...
'Selector',...
{@(name)~any(strcmp(name,{'Alaska','Hawaii'})),'Name'});
faceColors=makesymbolspec('Polygon',...
{'INDEX',[1numel(states)],'FaceColor',...
polcmap(numel(states))});%NOTE-colorsarerandom
geoshow(ax,states,'DisplayType','polygon',...
'SymbolSpec',faceColors)
framemoff;gridmoff;mlabeloff;plabeloff
Example4
MapoftheUSAwithseparateaxesforAlaskaandHawaii:
figure;ax=usamap('allequal');
set(ax,'Visible','off')
states=shaperead('usastatelo','UseGeoCoords',true);
names={states.Name};
indexHawaii=strmatch('Hawaii',names);
indexAlaska=strmatch('Alaska',names);
indexConus=1:
numel(states);
indexConus(indexHawaii)=[];
indexConus(indexAlaska)=[];
stateColor=[0.510.5];
geoshow(ax
(1),states(indexConus),'FaceColor',stateColor)
geoshow(ax
(2),states(indexAlaska),'FaceColor',stateColor)
geoshow(ax(3),states(indexHawaii),'FaceColor',stateColor)
fork=1:
3
setm(ax(k),'Frame','off','Grid','off',...
'ParallelLabel','off','MeridianLabel','off')
end
usamap
ConstructmapaxesforUnitedStatesofAmerica
Syntax
usamapstate
usamap(state)
usamap'conus'
usamap('conus')
usamap
usamap(latlim,lonlim)
usamap(Z,R)
h=usamap(...)
h=usamap('all')
h=usamap('allequal')
Description
usamapstateorusamap(state)constructsanemptymapaxeswithaLambertConformalConicprojectionandmaplimitscoveringaU.S.stateorgroupofstatesspecifiedbyinputstate.statemaybeastringoracellarrayofstrings,whereeachstringcontainsthenameofastateor'DistrictofColumbia'.Alternatively,statemaybeastandardtwo-letterU.S.PostalServiceabbreviation.Themapaxesiscreatedinthecurrentaxesandtheaxislimitsaresettightaroundthemapframe.
usamap'conus'orusamap('conus')constructsanemptymapaxesfortheconterminous48states(i.e.excludingAlaskaandHawaii).
usamapwithnoargumentsasksyoutochoosefromamenuofs