Light a Terrain Map of a Region

Light a terrain map of a region around South Boulder Peak in Colorado.

First, import elevation data and a geographic postings reference object. To plot the data using geoshow, the raster data must be of type double or single. Therefore, specify the data type for the raster using the 'OutputType' name-value pair.

[Z,R] = readgeoraster('n39_w106_3arc_v2.dt1','OutputType','double');

Then, display the data as a surface. Apply a colormap appropriate for terrain data using the demcmap function.

usamap(R.LatitudeLimits,R.LongitudeLimits);
geoshow(Z,R,'DisplayType','surface')
demcmap(Z)

Set the vertical exaggeration using the daspectm function. Then, specify a light source in the top left corner of the map. Find the coordinates of the top left corner by querying the LatitudeLimits and LongitudeLimits properties of the reference object.

daspectm('m',20)
cornerlat = R.LatitudeLimits(2);
cornerlon = R.LongitudeLimits(1);
lightm(cornerlat,cornerlon)

Restore the luminance of the map by specifying the ambient, diffuse, and specular light strength.

ambient = 0.7; 
diffuse = 1;
specular = 0.6;
material([ambient diffuse specular])

The DTED file used in this example is courtesy of the US Geological Survey.

See Also

|

Related Topics