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

    %% Drape Geoid Heights Over Topography
% This example shows the figure of the Earth (the geoid data set) draped on
% topographic relief (the topo data set). The geoid data is shown as an
% attribute (using a color scale) rather than being depicted as a 3-D
% surface itself. The two data sets are both 1-by-1-degree meshes sharing a
% common origin.
%%
% Load the topographic ( |topo| ) and geoid regular data grids.
load topo
load geoid
%%
% Create a map axes using a Gall stereographic cylindrical projection (a
% perspective projection). Use |meshm| to plot a colored display of the
% geoid's variations, but specify |topo| as the final argument, to give
% each |geoid| grid cell the height (_z_ value) of the corresponding |topo|
% grid cell. Low geoid heights are shown as blue, high ones as red.
axesm gstereo;
meshm(geoid,geoidrefvec,size(geoid),topo)
%%
% For reference, plot the world coastlines in black, raise their elevation
% to 1000 meters (high enough to clear the surface in their vicinity), and
% expand the map to fill the frame.
load coastlines
plotm(coastlat,coastlon,'k')
zdatam(handlem('allline'),1000)
tightmap
%%
% Due to the vertical view and lack of lighting, the topographic relief is
% not visible, but it is part of the figure's surface data. Bring it out by
% exaggerating relief greatly, and then setting a view from the
% south-southeast.
daspectm('m',200); tightmap
view(20,35)
%%
% Remove the bounding box, shine a light on the surface (using the default
% position, offset to the right of the viewpoint), and render again with
% Gouraud shading.
ax = gca;
ax.Box = 'off';
camlight;
lighting Gouraud
%%
% Finally, set the perspective to converge slightly (the default
% perspective is orthographic).  Notice that the geoid mirrors the
% topography of the major mountain chains such as the Andes, the Himalayas,
% and the Mid-Atlantic Ridge. You can also see that large areas of high or
% low geoid heights are not simply a result of topography.
ax.Projection = 'perspective';