KDM_MAP_SCALE
Name
KDM_MAP_SCALE
Purpose
Provide a scale (legend) for a map
Category
Map, Imaging
Calling Sequence
KDM_MAP_SCALE
Keyword Parameters
X: location (in units [0,1]) of X position of scale
Y: location (in units [0,1]) of Y position of scale
HIGHLIGHT: Set this keyword to try to make the text stand out
against the background of the map
Restrictions
Map coordinates must be defined (with, for example, MAP_SET)
Procedure
1) pick a point at (0.1, 0.1) from south west corner of map
2) convert /norm coordinates to lat/lon
3) pick a point at (0.3, 0.1) due east of first point
4) convert /norm to lat/lon
5) get distance between points in m
6) find nearest round number of format [1-9][0*]
7) find error between measured distance rounded goal number
8) adjust second point by error
9) repeat untill err < err_limit
10) draw line from (x0,y0) to newly determined (x1,y0) location
equal to nice round distance
11) add legend
Example
map_set, 41, -74.5, /ortho, scale=3e6 ; near NY
map_continents, /hi, /states, /US, color=254
kdm_map_scale, x=0.1 ; explicitely set the X location
OR
map_set, /ortho, /iso ; the whole globe!
map_continents
kdm_map_scale, x=0.1, y=0.4 ; select X and Y locations
Modification History
Written by: Ken Mankoff, 2009.
2010-02-02: KDM Added documentation.