## DESCRIPTION

d.mapgraph draws graphics that are described in standard input (default) or the UNIX input file name. If commands are entered via standard input, a ctrl-d is used to signal the end of input to d.mapgraph. This program performs essentially the same function as d.graph; however, point locations are specified to d.mapgraph in the geographic coordinate system of the user's current mapset and location (i.e., in map coordinates), rather than in graphics display screen coordinates.

The program can be run interactively or non-interactively. The user can run the program completely non-interactively by specifying the name of a file containing d.mapgraph graphics commands and the values of all needed parameters on the command line. The user can instead elect to run the program partially interactively, by specifying any/all of the parameters except the graphics input=name parameter on the command line. In this case, d.mapgraph will expect the user to input d.mapgraph graphics commands from standard input (i.e., the keyboard) and will (silently) prompt the user for these graphics commands. Alternately, the user can simply type d.mapgraph on the command line, and be prompted for the values of all parameters (the user can still input graphics commands from an input file using this form.) In this case, the user is presented with the standard GRASS parser interface.

d.mapgraph is used for drawing simple graphics on top of map layers. The coordinate system used by d.mapgraph is the same as that of the map layer displayed in the active display frame on the graphics monitor (or that of the user's current region, if no map is displayed).

The graphics language is simple and uses the following commands:

# comment
  A line of comment which is ignored in the processing.
move xpos ypos
  The current location is updated to xpos ypos (where these, respectively, are the easting and northing of geographic coordinates stated in the map coordinate system of the user's current GRASS location, falling within the current region and active frame). If unspecified by the user, the current location becomes (0,0). If, as most likely, the point (0,0) falls outside of the user's current region, graphics drawn there will not appear in the graphics frame.

  Note: use g.region to obtain the coordinates of current location. Use d.where to obtain specific map coordinates of various points on the raster map displayed in the active frame.
  Note: there must be a space between xpos and ypos.

draw xpos ypos
  A line is drawn in the current color from the current location to the new location xpos ypos, which then becomes the current location. xpos and ypos are (respectively) an easting and northing stated in the map coordinate system of the user's current GRASS location, and located within the user's current geographic region and active frame.

  Note: there must be a space between xpos and ypos.

color color
  Sets the current color to that stated. Color options are: red, orange, yellow, green, blue, indigo, violet, magenta, brown, gray, white, and black.
size xper yper
  Subsequent text will be drawn such that the text is xper percent of the display frame's width and yper percent of the display frame height. If not specified by the user, the text size becomes 5 percent of the active frame's width and 5 percent of the frame's height. This is equivalent to entering size 5 5.
text line-of-text
  The stated text is drawn at the current location using the current color and the current size.
icon type size x y
  Draws an icon of types o, x, or + with specified size at location x,y. Note: type o designates a square.
polygon xpos ypos
xpos ypos
.
.
.
  The map coordinates appearing on lines beneath the word polygon, one pair per line, circumscribe a polygon which is to be filled with the current color.

## NOTES

d.mapgraph is identical to the d.graph command, except for the difference in coordinate systems used.

d.mapgraph will complain if the user enters something to standard input that it does not understand. Blank lines in the input file will result in this error message.

## EXAMPLE

Draw some text in the center of the display:

       EAST=`g.region -c | grep east | cut -f2 -d:`
       NORTH=`g.region -c | grep north | cut -f2 -d:`

       d.mapgraph << EOF
         move $EAST $NORTH
         text GRASS
       EOF

## SEE ALSO

d.frame
d.graph
d.rast
d.zoom
g.region

## AUTHOR

James Westervelt, U.S. Army Construction Engineering Research Laboratory

Last changed: $Date: 2005/01/27 01:28:06 $