Mapping Toolbox | ![]() ![]() |
Displaying Data on a Base Map
The Mapping Toolbox can display geographic data contained in MATLAB data types such as vectors, matrices, and structures. The command names are usually similar to the MATLAB graphics commands, but with an "m" at the end. The "m" indicates that the data is geographic, and should be displayed using the already defined map projection. For example, in MATLAB you would display a vector of points as a line using plot(x,y)
, whereas for geographic data the command would be plotm(lat,long)
.
Since most map displays contain several kinds of information, new plot commands add to, rather than replace graphic elements on a map axes. Also, the scaling of x and y coordinates is set equal to make the map projections look right. Use the daspectm
command to control the scaling of the z axis.
The following example shows how you can find the geographic locations of points by clicking on a map, and then display the result with a mapping version of the plot command. Of course, your points will be different. To display the data as lines without symbols, or symbols without lines, change the line style specification:
Important geographic line data such as great circle tracks and small circles can also be calculated or created interactively. Great circle tracks are the shortest distance between points, and small circles are the locus of points a constant distance from a center point. You can use trackg
and scircleg
to create them by clicking on the map. If you extend-click on the tracks or circles, you can move the control points to modify the lines, or type specific numbers into a control panel. The control panels also allow the tracks and circles to be used for measurements on the map. Just adjust the lines or circles to the right place on the map, and read the dimensions off the control panel. Command-line functions accomplish similar tasks without map interaction.
Here are a great circle track from the United States to Japan and a 1000 km radius small circle centered on Tokyo. On a globe, the line would be straight, and the circle would be circular. The map projection introduces some characteristic distortion.
A common way to display matrix data is as contour lines. The Mapping Toolbox provides a number of ways to represent contours. Contour lines are created by contourm
, while filled contours drawn as patches are created by contourfm
. The same effect as contourfm
with equally spaced contours can be achieved by displaying the matrix as a surface and controlling the colormap with contourcmap
. The worldmap
geoid display is an example of this approach.
Here is the same geoid data displayed on top of a digital elevation map of the Korean peninsula. The contourm
and clabelm
commands display and label contours of geoid heights in steps of 10 meters:
load korea worldmap(map,maplegend,'dem') load geoid [c,h] = contourm(geoid,geoidlegend,-100:10:100,'r'); ht = clabelm(c,h); set(ht,'color','r') hidem(gca)
![]() | Creating Base Maps | Importing High-Resolution Atlas Data | ![]() |