Main Content

Change Map Projections Using geoshow

You can display latitude-longitude vector and raster geodata using the geoshow function (use mapshow to display preprojected coordinates and grids). When you use geoshow to display maps on a map axes, the data are projected according to the map projection assigned when axesm, worldmap, or usamap created the map axes (e.g., axesm('mapprojection','mercator')).

You can also use geoshow to display latitude-longitude data on a regular axes (created by the axes function, for example). When you do this, the latitude-longitude data are displayed using a pcarree, which linearly maps longitude to x and latitude to y.

Change Map Projection with Vector Data Using geoshow

This example shows how to change a map projection when displaying vector data using geoshow . If you need to change projections when displaying both raster and vector geodata, you can combine these techniques. Removing vector graphic objects does not affect raster data already displayed.

Display vector data using geoshow.

axesm miller
h = geoshow('landareas.shp');

Figure contains an axes. The axes contains 537 objects of type patch.

Delete the original map and change the projection.


Figure contains an axes. The axes contains 255 objects of type patch.

Change Map Projection with Raster Data Using geoshow

Get geoid heights and a geographic postings reference object from the EGM96 geoid model. Then, display the data using a Mercator projection.

[N,R] = egm96geoid;
axesm mercator

Figure contains an axes. The axes contains an object of type surface.

Change the projection using the setm function.


Figure contains an axes. The axes contains an object of type surface.