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.

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

Delete the original map and change the projection.

delete(h)
setm(gca,'mapprojection','ortho')
geoshow('landareas.shp')

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
geoshow(N,R,'DisplayType','surface')

Change the projection using the setm function.

setm(gca,'mapprojection','mollweid')