man d.mapgraph () - Generates and displays simple graphics on map layers drawn in the active graphics monitor display frame.


d.mapgraph - Generates and displays simple graphics on map layers drawn in the active graphics monitor display frame.



d.mapgraph help

d.mapgraph [input=string] [color=string]


Unix file containg graphing instructions
Starting color desired for graphics Options: red,orange,yellow,green,blue,indigo,violet,white,black,gray,brown,magenta,aqua,grey Default: black


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:

A line of comment which is ignored in the processing.

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.

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.

Sets the current color to that stated. Color options are: red, orange, yellow, green, blue, indigo, violet, magenta, brown, gray, white, and black.

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.


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.


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


text GRASS










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

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

Help Index