man d.what.rast () - Allows the user to interactively query the category contents of multiple raster map layers at user specified locations within the current geographic region.


d.what.rast - Allows the user to interactively query the category contents of multiple raster map layers at user specified locations within the current geographic region.



d.what.rast help

d.what.rast [-1tc] map=string[,string,...] [fs=string]


Identify just one location
Terse output. For parsing by programs
Print out col/row for the entire map in grid resolution of the region


Name of existing raster map(s)
Field separator (terse mode only) Default: :


d.what.rast outputs the category values and labels associated with cell(s) at user-specified location(s) on user-named raster map layer(s).

The program will query the contents of raster map layer(s) named by the user on the command line. These map layers must exist in the user's current mapset search path. If the user does not name any raster map layers on the command line, d.what.rast will query the category contents of whatever raster map layer is already displayed in the active frame on the graphics monitor.

The program activates the mouse, and expects the user to indicate the cell location(s) to be queried by depressing a mouse button over desired location(s) within the current geographic region in the active display frame on the graphic monitor.


It is helpful, but not necessary, to first display a map to be used for reference in the active display frame before running d.what.rast. For example, the user might type the following series of commands and receive the output below.


To first display the soils map in the active frame.


User then moves the mouse to desired location on the displayed soils map layer, and presses the left mouse button to query the category contents of the soils and aspect maps at this geographic location. The program then outputs the below information to the user's terminal.

617112(E) 3732014(N)

soils in PERMANENT (44)Nunn clay loam, NdC

aspect in PERMANENT (20)15 degrees north of west

The first line of output gives the easting (E) and northing (N) coordinates of the geographic location at which the user clicked the mouse. Subsequent lines give the selected map(s) name and mapset, map category value (within parentheses), and map category label corresponding to this user-selected map location.

The query may be repeated as often as desired using the left mouse button. The right button on the mouse is used to quit the d.what.rast session.

Users can set the -t flag to obtain a terse output from d.what.rast. This is useful when the user wishes output to be parsed by another program (like awk). If the -t flag is set, users can also select the field separator used (with the fs=name option), or elect to use the default : field separator. In this case, the command


produces output in the form shown below. The first line of output gives the easting, northing, and the mouse button return value (see NOTES below). Each subsequent line gives the map name and its mapset, the category value, and category label of the point specified on the user-named raster map layers. The default output field separator, a colon, is used since none was specified on the command line.


soils@PERMANENT:44:Nunn clay loam, NdC

aspect@PERMANENT:20:15 degrees north of west

Users can also use this program inside of shell scripts that require as input a map category value and a mouse button depressed. Users can choose an option to run d.what.rast only once, and return only the map category value found and the number of the mouse button depressed.


Mouse button return values are as follows: 0 indicates no button was pressed, 1 indicates that the left mouse button was pressed, 2 indicates the middle button was pressed, and 3 indicates that the right mouse button was pressed.

d.what.rast will always print its output to the terminal screen. d.what.rast output can be redirected into a file; however, if it is, the output will go both to the screen and to the file. For example:


will both send d.what.rast output to the screen and capture its output in the file named what.out.

The maximum number of raster map layers that can be queried at one time is 15.

d.what.vect allows the user to interactively query the category contents of multiple vector map layers at user-specified locations.






Michael Shapiro, U.S. Army Construction Engineering Research Laboratory

Last changed: $Date: 2004/08/05 12:53:21 $

Help Index