This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Construct map axes for given region of world


worldmap region
worldmap(latlim, lonlim)
worldmap(Z, R)
h = worldmap(...)


worldmap region or worldmap(region) sets up an empty map axes with projection and limits suitable to the part of the world specified in region. region can be a character vector or a cell array of character vectors. Permissible values include names of continents, countries, and islands as well as 'World', 'North Pole', 'South Pole', and 'Pacific'.

worldmap with no arguments presents a menu from which you can select the name of a single continent, country, island, or region.

worldmap(latlim, lonlim) allows you to define a custom geographic region in terms of its latitude and longitude limits in degrees. latlim and lonlim are two-element vectors of the form [southern_limit northern_limit] and [western_limit eastern_limit], respectively.

worldmap(Z, R) derives the map limits from the extent of a regular data grid georeferenced by R. R can be a geographic raster reference object, a referencing vector, or a referencing matrix.

If R is a geographic raster reference object, its RasterSize property must be consistent with size(Z).

If R is a referencing vector, it must be a 1-by-3 with elements:

[cells/degree northern_latitude_limit western_longitude_limit]

If R is a referencing matrix, it must be 3-by-2 and transform raster row and column indices to/from geographic coordinates according to:

[lon lat] = [row col 1] * R

If R is a referencing matrix, it must define a (non-rotational, non-skewed) relationship in which each column of the data grid falls along a meridian and each row falls along a parallel.

h = worldmap(...) returns the handle of the map axes.

All axes created with worldmap are initialized with a spherical Earth model having a radius of 6,371,000 meters.

worldmap uses tightmap to adjust the axes limits around the map. If you change the projection, or just want more white space around the map frame, use tightmap again or auto axis


collapse all

Set up a world map and draw coarse coastlines.

load coastlines

Set up a world map with land areas, major lakes and rivers, and cities and populated places.

ax = worldmap('World');
setm(ax, 'Origin', [0 180 0])
land = shaperead('landareas', 'UseGeoCoords', true);
geoshow(ax, land, 'FaceColor', [0.5 0.7 0.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')

Draw a map of Antarctica, using the worldmap function.

antarctica = shaperead('landareas', 'UseGeoCoords', true,...
  'Selector',{@(name) strcmp(name,'Antarctica'), 'Name'});
patchm(antarctica.Lat, antarctica.Lon, [0.5 1 0.5])

Draw a map of Africa and India with major cities and populated areas.

land = shaperead('landareas.shp', 'UseGeoCoords', true);
geoshow(land, 'FaceColor', [0.15 0.5 0.15])
cities = shaperead('worldcities', 'UseGeoCoords', true);
geoshow(cities, 'Marker', '.', 'Color', 'red')

Make a map of the geoid over South America and the central Pacific.

worldmap([-50 50],[160 -30])
load geoid
geoshow(geoid, geoidrefvec, 'DisplayType', 'texturemap');
load coastlines

Draw a map of terrain elevations in Korea.

load korea
h = worldmap(map, refvec);
set(h, 'Visible', 'off')
geoshow(h, map, refvec, 'DisplayType', 'texturemap')

Make a map of the United States of America, coloring state polygons.

ax = worldmap('USA');
load coastlines
geoshow(ax, coastlat, coastlon,...
'DisplayType', 'polygon', 'FaceColor', [.45 .60 .30])
states = shaperead('usastatelo', 'UseGeoCoords', true);
faceColors = makesymbolspec('Polygon',...
    {'INDEX', [1 numel(states)], 'FaceColor', ...
    polcmap(numel(states))}); % NOTE - colors are random
geoshow(ax, states, 'DisplayType', 'polygon', ...
  'SymbolSpec', faceColors)

Introduced before R2006a

Was this topic helpful?