Generate Shaded Relief Map using Raster Data

This example shows how to generate a shaded relief map using raster data, also known as a data grid. Note that the content, symbolization, and the projection of the map are completely independent. The structure and content of the topo data grid are the same no matter how you display it, although how it is projected and symbolized can affect its interpretation.

Load the topo data grid from the topo MAT-file and examine the variables returned to the workspace. The data grid topo contains raster elevation data.

load topo
whos
  Name              Size              Bytes  Class     Attributes

  topo            180x360            518400  double              
  topolatlim        1x2                  16  double              
  topolegend        1x3                  24  double              
  topolonlim        1x2                  16  double              
  topomap1         64x3                1536  double              
  topomap2        128x3                3072  double              

Create a raster referencing object to georeference the topo data grid.

topoR = georefcells(topolatlim,topolonlim,size(topo))
topoR = 
  GeographicCellsReference with properties:

             LatitudeLimits: [-90 90]
            LongitudeLimits: [0 360]
                 RasterSize: [180 360]
       RasterInterpretation: 'cells'
           ColumnsStartFrom: 'south'
              RowsStartFrom: 'west'
       CellExtentInLatitude: 1
      CellExtentInLongitude: 1
     RasterExtentInLatitude: 180
    RasterExtentInLongitude: 360
           XIntrinsicLimits: [0.5 360.5]
           YIntrinsicLimits: [0.5 180.5]
       CoordinateSystemType: 'geographic'
                  AngleUnit: 'degree'


Create an equal-area map projection to view the topographic data. axesm creates a figure window with map axes set to display a sinusoidal projection. Then generate a shaded relief map. One way to do this is to use geoshow and apply a topographic colormap using demcmap. geoshow displays the geodata in geographic (unprojected) coordinates.

axesm sinusoid;
geoshow(topo,topoR,'DisplayType','texturemap')
demcmap(topo)

Create a new figure using a Hammer projection (which, like the sinusoidal, is also equal-area), and display the topo data grid using meshlsrm, which enables control of lighting effects. This renders a colored relief map of the topo data set, illuminated from the east, in the second figure window.

figure;
axesm hammer
meshlsrm(topo,topoR)