Note: Please see the MAPGRID function, which replicates the functionality of this routine and offers an interactive interface.

The MAP_GRID procedure draws the graticule of parallels and meridians (grid lines) over a map projection.

The MAP_STRUCTURE keyword may be used to draw directly to UV (Cartesian) coordinates. Otherwise, MAP_SET must be called before MAP_GRID to establish the projection type, the center of the projection, polar rotation and geographical limits.

Examples


The following example creates an orthographic projection, defines which latitudes to label, and provides text labels. Note that the text labels are rotated to match the orientation of the map projection.

; Set up an orthographic projection:
MAP_SET, /ORTHO, 10, 20, 30, /ISOTROPIC, /CONTINENTS, /HORIZON
; Define latitudes of interest:
lats = [ -80, -45, -30, -20, 0, 15, 27, 35, 45, 55, 75]
; Create string equivalents of latitudes:
latnames = strtrim(lats, 2)
; Label the equator:
latnames(where(lats eq 0)) = 'Equator'
; Draw the grid:
MAP_GRID, LABEL=2, LATS=lats, LATNAMES=latnames, LATLAB=7, $
   LONLAB=-2.5, LONDEL=20, LONS=-15, ORIENTATION=-30

The following example uses the MAP_STRUCTURE keyword to map the grid lines in UV (Cartesian) coordinates, without having to set up a !MAP transform using MAP_SET.

; GCTP Polar stereographic projection
mapStruct = MAP_PROJ_INIT(106, LIMIT=[0,-180,90,180], $
   CENTER_LATITUDE=90)
; Create a plot window using the UV Cartesian range.
PLOT, mapStruct.uv_box[[0,2]],mapStruct.uv_box[[1,3]], $
   /NODATA, /ISOTROPIC, XSTYLE=1, YSTYLE=1
MAP_CONTINENTS, MAP_STRUCTURE=mapStruct
MAP_GRID, MAP_STRUCTURE=mapStruct

Syntax


MAP_GRID [, /BOX_AXES | [, CLIP_TEXT=0] [, LATALIGN=value{0.0 to 1.0}] [, LONALIGN=value{0.0 to 1.0}] [, LATLAB=longitude] [, LONLAB=latitude] [, ORIENTATION=clockwise_degrees_from_horiz]]
[, CHARSIZE=value] [, COLOR=index] [, /FILL_HORIZON] [, GLINESTYLE={0 | 1 | 2 | 3 | 4 | 5}] [, GLINETHICK=value] [, /HORIZON] [, INCREMENT=value] [, LABEL=n{label_every_nth_gridline}] [, LATDEL=degrees] [, LATNAMES=array, LATS=vector] [, LONDEL=degrees] [, LONNAMES=array, LONS=vector] [, MAP_STRUCTURE=structure] [, /NO_GRID]

Graphics Keywords: [, /T3D] [, ZVALUE=value{0 to 1}]

Keywords


BOX_AXES

Set this keyword to create box-style axes for map plots where the parallels intersect the sides, and the meridians intersect the bottom and top edges of the box.

Note: If a device (or hardware) font is in use, the labels generated by this keyword may appear incorrectly. Consider using TrueType or vector fonts instead.

CHARSIZE

Set this keyword to the size of the characters used for the labels. The default is 1.

Note: If a device (or hardware) font is in use, this keyword will have no effect. Use the FONTSIZE keyword to the DEVICE Procedure to specify character size when using hardware fonts.

CLIP_TEXT

Set this keyword to a zero value to turn off clipping of text labels. By default, text labels are clipped. This keyword is ignored if the BOX_AXES keyword is set.

COLOR

Set this keyword to the color index for the grid lines.

FILL_HORIZON

Set this keyword to fill the current map_horizon.

GLINESTYLE

If set, the line style used to draw the grid of parallels and meridians. See LINESTYLE for a list of available linestyles. The default index is 1, drawing a dotted line.

GLINETHICK

Set this keyword to the thickness of the grid lines. Default is 1.

HORIZON

Set this keyword to draw the current map horizon.

INCREMENT

Set this keyword to the spacing between graticle points.

LABEL

Set this keyword to label the parallels and meridians with their corresponding latitudes and longitudes. Setting this keyword to an integer will cause every LABEL gridline to be labeled (that is, if LABEL=3 then every third gridline will be labeled). The starting point for determining which gridlines are labeled is the minimum latitude or longitude (-180 to 180), unless the LATS or LONS keyword is set to a single value. In this case, the starting point is the value of LATS or LONS.

LATALIGN

This keyword controls the alignment of the text baseline for latitude labels. A value of 0.0 left justifies the label, 1.0 right justifies it, and 0.5 centers it. This keyword is ignored if the BOX_AXES keyword is set.

LATDEL

Set this keyword equal to the spacing (in degrees) between parallels of latitude in the grid. If this keyword is not set, a suitable value is determined from the current map projection.

LATLAB

The longitude at which to place latitude labels. The default is the center longitude on the map. This keyword is ignored if the BOX_AXES keyword is set.

LATNAMES

Set this keyword equal to an array specifying the names to be used for the latitude labels. By default, this array is automatically generated in units of degrees. The LATNAMES array can be either type string or any single numeric type, but should not be of mixed type.

When LATNAMES is specified, the LATS keyword must also be specified. The number of elements in the two arrays need not be equal. If there are more elements in the LATNAMES array than in the LATS array, the extra LATNAMES are ignored. If there are more elements in the LATS array than in the LATNAMES array, labels in degrees will be automatically provided for the missing latitude labels.

The LATNAMES keyword can be also used when the LATS keyword is set to a single value. It this case, the first label supplied will be used at the specified latitude; subsequent names will be placed at the next latitude line to the north, wrapping around the globe if appropriate. Caution should be used when using LATNAMES in conjunction with a single LATS value, since the number of visible latitude gridlines is dependent on many factors.

LATS

Set this keyword equal to a one or more element vector of latitudes for which lines will be drawn (and optionally labeled). If LATS is omitted, appropriate latitudes will be generated based on the value of the (optional) LATDEL keyword. If LATS is set to a single value, that latitude and a series of automatically generated latitudes will be drawn (and optionally labeled). Automatically generated latitudes have the values:

[...,LATS-LATDEL,LATS,LATS+LATDEL,...] 

over the extent of the map. If LATS is a single value, that value is taken to be the starting point for labelling (See the LABEL keyword).

LONALIGN

This keyword controls the alignment of the text baseline for longitude labels. A value of 0.0 left justifies the label, 1.0 right justifies it, and 0.5 centers it. This keyword is ignored if the BOX_AXES keyword is set.

LONDEL

Set this keyword equal to the spacing (in degrees) between meridians of longitude in the grid. If this keyword is not set, a suitable value is determined from the current map projection.

LONLAB

The latitude at which to place longitude labels. The default is the center latitude on the map. This keyword is ignored if the BOX_AXES keyword is set.

LONNAMES

Set this keyword equal to an array specifying the names to be used for the longitude labels. By default, this array is automatically generated in units of degrees. The LONNAMES array can be either type string or any single numeric type, but should not be of mixed type.

When LONNAMES is specified, the LONS keyword must also be specified. The number of elements in the two arrays need not be equal. If there are more elements in the LONNAMES array than in the LONS array, the extra LONNAMES are ignored. If there are more elements in the LONS array than in the LONNAMES array, labels in degrees will be automatically provided for the missing longitude labels.

The LONNAMES keyword can be also used when the LONS keyword is set to a single value. It this case, the first label supplied will be used at the specified longitude; subsequent names will be placed at the next longitude line to the east, wrapping around the globe if appropriate. Caution should be used when using LONNAMES in conjunction with a single LONS value, since the number of visible longitude gridlines is dependent on many factors.

LONS

Set this keyword equal to a one or more element vector of longitudes for which lines will be drawn (and optionally labeled). If LONS is omitted, appropriate longitudes will be generated based on the value of the (optional) LONDEL keyword. If LONS is set to a single value, that longitudes and a series of automatically generated longitudes will be drawn (and optionally labeled). Automatically generated longitudes have the values:

[...,LONS-LONDEL,LONS,LONS+LONDEL,...] 

over the extent of the map. If LONS is a single value, that value is taken to be the starting point for labelling (See the LABEL keyword).

MAP_STRUCTURE

Set this keyword to a !MAP structure, as returned from MAP_PROJ_INIT. If this keyword is set, the !MAP system variable is ignored, and the grid lines are drawn using UV (Cartesian) coordinates.

NO_GRID

Set this keyword if you only want labels but not gridlines.

ORIENTATION

Set this keyword equal to an angle in degrees from horizontal (in the clockwise direction) to rotate the labels. This keyword is ignored if the BOX_AXES keyword is set.

Note: If a device (or hardware) font is in use, this keyword will have no effect.

Version History


Pre 4.0

Introduced

6.1

Added MAP_STRUCTURE keyword

See Also


MAP_CONTINENTS Procedure, MAP_IMAGE, MAP_PATCH, MAP_PROJ_INIT, MAP_SET Procedure