r.what(1)
π r.what π
ok so bestie, welcome to r.what β that's the GRASS GIS User's Manual page for it, r.what(1), and honestly? it's a banger. it's the tool that goes "hey what even IS at this spot" and then tells you, for real for real. πΈ
β¨ NAME β¨
r.what β queries raster maps on their category values and category labels. that's it. that's the whole job. and she does it flawlessly. π
π KEYWORDS π
raster, querying, position
π«Ά SYNOPSIS π«Ά
r.what
r.what --help
r.what [-nfricv] map=name[,name,...] [coordinates=east,north]
[points=name] [null_value=string] [output=name]
[separator=character] format=name [cache=integer] [--overwrite]
[--help] [--verbose] [--quiet] [--ui]
π Flags π
-nβ Output header row. yes queen, give us the column names.-fβ Show the category labels of the grid cell(s). the actual words, not just numbers, iconic.-rβ Output color values asRRR:GGG:BBB. rgb girlies rise up π-iβ Output integer category values, not cell values.-cβ Turn on cache reporting.-vβ Show the category for vector points map. (this is the one that gets you thecatper feature, iykyk)--overwriteβ Allow output files to overwrite existing files. careful bestie π--helpβ Print usage summary.--verboseβ Verbose module output.--quietβ Quiet module output.--uiβ Force launching GUI dialog.
π¦ Parameters π¦
map=name[,name,...][required] β Name of existing raster map(s) to query.coordinates=east,northβ Coordinates for query.points=nameβ Name of vector points map for query.- Or data source for direct OGR access.
null_value=stringβ String representing NULL value.- Default:
*
- Default:
output=nameβ Name for output file (if omitted or-output to stdout).separator=characterβ Field separator.- Special characters: pipe, comma, space, tab, newline
- Default:
pipe
format=name[required] β Output format.- Options:
plain,json - Default:
plain plain: Plain text outputjson: JSON (JavaScript Object Notation)
- Options:
cache=integerβ Size of point cache.- Default:
500
- Default:
π DESCRIPTION π
ok so r.what outputs the category values and (optionally) the category labels associated with user-specified locations on raster input map(s). you point at a spot, she tells you what's there. simple as. β¨
Locations are specified as geographic x,y coordinate pairs (i.e., pair of eastings and northings); the user can also (optionally) associate a label with each location. cute little name tag for each point, love that for us π·οΈ
The input coordinates can be entered directly on the command line via coordinates parameter, or redirected via stdin from an input text file, script, or piped from another program (like v.out.ascii). Coordinates can be given also as a vector points map (points). three whole ways to feed her, she's flexible like that πββοΈ
If none of the above input methods are used and the module is run from the terminal prompt, the program will interactively query the user for point locations and labels. she'll literally just ask you. main character energy π€
Each line of the input consists of an easting, a northing, and an optional label, which are separated by spaces. In interactive mode, the word "end" must be typed after the last pair of input coordinates. don't forget the end, bestie, she'll wait forever π
r.what output consists of the input geographic location and label, and, for each user-named raster map layer, the category value, and (if the -f label flag is specified) the category label associated with the cell(s) at this geographic location. so much info, so little time π«Ά
π EXAMPLES π
π Input coordinates given as an option
The module's coordinates parameter can be used to enter coordinate pairs directly. The maximum number of pairs will be limited by your system's maximum input line length (e.g. 4096 characters). yeah she's got a limit, it's a line-length thing, not a her thing π
g.region raster=landuse96_28m,aspect -p
r.what map=landuse96_28m,aspect coordinates=633614.08,224125.12,632972.36,225382.87 -f
633614.08|224125.12||2|Low Intensity Developed|209.5939|209 degrees ccw from east
632972.36|225382.87||15|Southern Yellow Pine|140.7571|140 degrees ccw from east
π Input coordinates given as a vector points map
Coordinates can be read from existing vector points map by specifying points option. Other features than points or centroids are ignored. Example: query North Carolina county number for each community college:
g.region raster=boundary_county_500m -p
r.what map=boundary_county_500m points=comm_colleges
145096.859150|154534.264884||39
616341.437150|146049.750884||51
...
π Input coordinates given as a vector points map with cats
Coordinates can be read from existing vector points map by specifying points option. Other features than points or centroids are ignored. Using the v flag you can get also the cat for each feature. Example: query North Carolina county number for each community college:
g.region raster=boundary_county_500m -p
r.what map=boundary_county_500m points=comm_colleges -v
1|145096.859150|154534.264884||39
2|616341.437150|146049.750884||51
...
π Input coordinates given as a vector points map, output into CSV file
Coordinates can be read from existing vector points map by specifying points option. Other features than points or centroids are ignored. The output is stored in a CSV file including header row. Example: query North Carolina county number for each community college:
g.region raster=boundary_county_500m -p
r.what map=boundary_county_500m points=comm_colleges \
separator=comma output=result.csv -n
cat result.csv
easting,northing,site_name,boundary_county_500m
145096.859150,154534.264884,,39
616341.437150,146049.750884,,51
410595.719150,174301.828884,,71
...
π Input from a text file containing coordinates
The contents of an ASCII text file can be redirected to r.what as follows. If we have a file called input_coord.txt containing the whitespace separated coordinates and optionally labels, the resulting raster map values are extracted:
cat input_coord.txt
633614.08 224125.12 site 1
632972.36 225382.87 site 2
r.what map=landuse96_28m,aspect < input_coord.txt
633614.08|224125.12|site 1|2|209.5939
632972.36|225382.87|site 2|15|140.7571
β¨οΈ Input from standard input on the command line
Input coordinates may be given directly from standard input (stdin), for example (input data appears between the "EOF" markers):
r.what map=landuse96_28m,aspect << EOF
633614.08 224125.12 site 1
632972.36 225382.87 site 2
EOF
633614.08|224125.12|site 1|2|209.5939
632972.36|225382.87|site 2|15|140.7571
echo "633614.08 224125.12" | r.what map=landuse96_28m,aspect
633614.08|224125.12||2|209.5939
π Input coordinates piped from another program
The input coordinates may be "piped" from the standard output (stdout) of another program. In the next example, vector point coordinates are piped from the v.out.ascii module.
v.out.ascii comm_colleges separator=space | r.what map=boundary_county_500m
145096.8591495|154534.26488388|1|39
616341.4371495|146049.75088388|2|51
410595.7191495|174301.82888388|3|71
...
π·οΈ Output containing raster map category labels
Here we use the -f label flag to enable the output of category labels associated with the raster cell(s), as well as values (categorical maps only).
r.what -f map=landuse96_28m,aspect << EOF
633614.08 224125.12 site 1
632972.36 225382.87 site 2
EOF
633614.08|224125.12|site 1|2|Low Intensity Developed|209.5939|209 degrees ccw from east
632972.36|225382.87|site 2|15|Southern Yellow Pine|140.7571|140 degrees ccw from east
β οΈ NOTE β οΈ
The maximum number of raster map layers that can be queried at one time is 400. that's the cap, bestie, no negotiating π
π TODO π
- Fix
400maps limit
π SEE ALSO π
r.category, r.report, r.stats, r.series, r.univar, v.what, v.what.rast, v.what.vect
π AUTHORS π
Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
Vector point input added by Martin Landa, Czech Technical University in Prague, Czech Republic
π₯ SOURCE CODE π₯
Available at: r.what source code (history)
Accessed: Saturday Jan 17 05:41:06 2026
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual
ok that's the whole thing, and like β that's a wrap bestie π you just read the GRASS GIS 8.4.2 Reference Manual page for r.what(1), last touched Saturday Jan 17 05:41:06 2026, and it's all Β© 2003-2025 GRASS Development Team. go query something gorgeous. no cap. πβ¨π¦
π¦ where this page comes from
- fedora 44: grass 8.4.2-4.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms