Mapping Toolbox | ![]() ![]() |
Image and Surface Coloring
The simplest way to display a matrix map is to assign colors to matrix elements according to the value of their data. The map can be displayed either as a 2-D image or a 3-D surface using the map values as the z data.
Consider the matrix map located in the korea
workspace. It contains a matrix of land elevations and bathymetry data for the region around the Korean peninsula, along with a map legend variable, which indicates a regular matrix map format. Calculate a graticule for the regular matrix map using the meshgrat
function so that a general matrix map is also available. Also, convert the units for the map matrix from meters to degrees, so they are consistent with the latitude and longitude coordinate matrices.
load korea [lat,lon] = meshgrat(map,maplegend); map = km2deg(map/1000); whos
|
|
|
|
|
|
|
|
|
180x240 |
345600 |
|
|
180x240 |
345600 |
|
|
180x240 |
345600 |
|
maplegend |
1x3 |
|
|
Notice that the lat
and lon
coordinate matrices, or graticule, are the same size as the map
matrix, a requirement for constructing 3-D surfaces.
You have already seen the meshm
command used to display regular matrix maps, so display the korea
matrix map using the surfm
command:
axesm('MapProjection','eqaconic','MapParallels',[],... 'MapLatLimit',[30 45],'MapLonLimit',[115 135]) surfm(lat,lon,map,map); demcmap(map) set(gca,'DataAspectRatio',[1 1 .5]) view(0,75)
Surface Light Shading
A monochrome three-dimensional, shaded-relief map can be displayed with the function surflm
, which is analogous to the MATLAB surfl
command. This functionality is available only for general matrix maps. Remember that regular matrix maps are a subset of general matrix maps and can be easily converted.
To display a map in this format, enter the following:
This is the same region as the previous map, viewed in three dimensions. Notice the dramatic dip in the lower-right portion of the map caused by the deep ocean trenches of the North Pacific Ocean. The view is from the south, at an elevation angle of 75°. The light source in this case is the default 45° counterclockwise from the view direction.
This kind of representation shows much more of the fine structure of the land and sea floor, but because of the lack of color, it is difficult to distinguish land from sea.
Surface Lighted Shaded Relief
The commands meshlsrm
and surflsrm
display maps in a lighted shaded relief format and can be thought of as extensions to surflm
that combine surface coloring and surface light shading. Again, meshlsrm
is used for regular matrix maps and surflsrm
for general matrix maps. Although there are no analogous MATLAB functions, you can obtain similar results using MATLAB light objects. However, unlike MATLAB lighted surfaces that do not modify the surface's CData
, these mapping commands construct a new colormap and associated CData
matrix by using grayscales to lighten or darken a matrix component based on its calculated surface normal to a light source.
To display a lighted shaded relief map, type the following:
![]() | The Graticule | Mapped Light Objects | ![]() |