www.gusucode.com > map 案例源码 matlab代码程序 > map/GenerateShadedReliefMapUsingRasterDataExample.m

    %% 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.

% Copyright 2015 The MathWorks, Inc.

load topo
whos
%%
% Create a raster referencing object to georeference the |topo| data grid.
topoR = georefcells(topolatlim,topolonlim,size(topo))
%%
% 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)