1r.what(1) Grass User's Manual r.what(1)
2
3
4
6 r.what - Queries raster maps on their category values and category
7 labels.
8
10 raster, querying, position
11
13 r.what
14 r.what --help
15 r.what [-nfricv] map=name[,name,...] [coordinates=east,north]
16 [points=name] [null_value=string] [output=name] [separator=char‐
17 acter] [cache=integer] [--overwrite] [--help] [--verbose]
18 [--quiet] [--ui]
19
20 Flags:
21 -n
22 Output header row
23
24 -f
25 Show the category labels of the grid cell(s)
26
27 -r
28 Output color values as RRR:GGG:BBB
29
30 -i
31 Output integer category values, not cell values
32
33 -c
34 Turn on cache reporting
35
36 -v
37 Show the category for vector points map
38
39 --overwrite
40 Allow output files to overwrite existing files
41
42 --help
43 Print usage summary
44
45 --verbose
46 Verbose module output
47
48 --quiet
49 Quiet module output
50
51 --ui
52 Force launching GUI dialog
53
54 Parameters:
55 map=name[,name,...]Â [required]
56 Name of existing raster map(s) to query
57
58 coordinates=east,north
59 Coordinates for query
60
61 points=name
62 Name of vector points map for query
63 Or data source for direct OGR access
64
65 null_value=string
66 String representing NULL value
67 Default: *
68
69 output=name
70 Name for output file (if omitted or "-" output to stdout)
71
72 separator=character
73 Field separator
74 Special characters: pipe, comma, space, tab, newline
75 Default: pipe
76
77 cache=integer
78 Size of point cache
79 Default: 500
80
82 r.what outputs the category values and (optionally) the category labels
83 associated with user-specified locations on raster input map(s). Loca‐
84 tions are specified as geographic x,y coordinate pairs (i.e., pair of
85 eastings and northings); the user can also (optionally) associate a
86 label with each location.
87
88 The input coordinates can be entered directly on the command line via
89 coordinates parameter, or redirected via stdin from an input text file,
90 script, or piped from another program (like v.out.ascii). Coordinates
91 can be given also as a vector points map (points).
92
93 If none of the above input methods are used and the module is run from
94 the terminal prompt, the program will interactively query the user for
95 point locations and labels.
96
97 Each line of the input consists of an easting, a northing, and an
98 optional label, which are separated by spaces. In interactive mode, the
99 word "end" must be typed after the last pair of input coordinates.
100
101 r.what output consists of the input geographic location and label, and,
102 for each user-named raster map layer, the category value, and (if the
103 -f label flag is specified) the category label associated with the
104 cell(s) at this geographic location.
105
107 Input coordinates given as an option
108 The module’s coordinates parameter can be used to enter coordinate
109 pairs directly. The maximum number of pairs will be limited by your
110 system’s maximum input line length (e.g. 4096 characters).
111 g.region raster=landuse96_28m,aspect -p
112 r.what map=landuse96_28m,aspect coordinates=633614.08,224125.12,632972.36,225382.87 -f
113 633614.08|224125.12||2|Low Intensity Developed|209.5939|209 degrees ccw from east
114 632972.36|225382.87||15|Southern Yellow Pine|140.7571|140 degrees ccw from east
115
116 Input coordinates given as a vector points map
117 Coordinates can be read from existing vector points map by specifying
118 points option. Other features than points or centroids are ignored.
119 Example: query North Carolina county number for each community college:
120 g.region raster=boundary_county_500m -p
121 r.what map=boundary_county_500m points=comm_colleges
122 145096.859150|154534.264884||39
123 616341.437150|146049.750884||51
124 ...
125
126 Input coordinates given as a vector points map with cats
127 Coordinates can be read from existing vector points map by specifying
128 points option. Other features than points or centroids are ignored.
129 Using the v flag you can get also the cat for each feature. Example:
130 query North Carolina county number for each community college:
131 g.region raster=boundary_county_500m -p
132 r.what map=boundary_county_500m points=comm_colleges -v
133 1|145096.859150|154534.264884||39
134 2|616341.437150|146049.750884||51
135 ...
136
137 Input coordinates given as a vector points map, output into CSV file
138 Coordinates can be read from existing vector points map by specifying
139 points option. Other features than points or centroids are ignored. The
140 output is stored in a CSV file including header row. Example: query
141 North Carolina county number for each community college:
142 g.region raster=boundary_county_500m -p
143 r.what map=boundary_county_500m points=comm_colleges \
144 separator=comma output=result.csv -n
145 cat result.csv
146 easting,northing,site_name,boundary_county_500m
147 145096.859150,154534.264884,,39
148 616341.437150,146049.750884,,51
149 410595.719150,174301.828884,,71
150 ...
151
152 Input from a text file containing coordinates
153 The contents of an ASCII text file can be redirected to r.what as fol‐
154 lows. If we have a file called input_coord.txt containing the white‐
155 space separated coordinates and optionally labels, the resulting raster
156 map values are extracted:
157 cat input_coord.txt
158 633614.08 224125.12 site 1
159 632972.36 225382.87 site 2
160 r.what map=landuse96_28m,aspect < input_coord.txt
161 633614.08|224125.12|site 1|2|209.5939
162 632972.36|225382.87|site 2|15|140.7571
163
164 Input from standard input on the command line
165 Input coordinates may be given directly from standard input (stdin),
166 for example (input data appears between the "EOF" markers):
167 r.what map=landuse96_28m,aspect << EOF
168 633614.08 224125.12 site 1
169 632972.36 225382.87 site 2
170 EOF
171 633614.08|224125.12|site 1|2|209.5939
172 632972.36|225382.87|site 2|15|140.7571
173 echo "633614.08 224125.12" | r.what map=landuse96_28m,aspect
174 633614.08|224125.12||2|209.5939
175
176 Input coordinates piped from another program
177 The input coordinates may be "piped" from the standard output (stdout)
178 of another program. In the next example, vector point coordinates are
179 piped from the v.out.ascii module.
180 v.out.ascii comm_colleges separator=space | r.what map=boundary_county_500m
181 145096.8591495|154534.26488388|1|39
182 616341.4371495|146049.75088388|2|51
183 410595.7191495|174301.82888388|3|71
184 ...
185
186 Output containing raster map category labels
187 Here we use the -f label flag to enable the output of category labels
188 associated with the raster cell(s), as well as values (categorical maps
189 only).
190 r.what -f map=landuse96_28m,aspect << EOF
191 633614.08 224125.12 site 1
192 632972.36 225382.87 site 2
193 EOF
194 633614.08|224125.12|site 1|2|Low Intensity Developed|209.5939|209 degrees ccw from east
195 632972.36|225382.87|site 2|15|Southern Yellow Pine|140.7571|140 degrees ccw from east
196
198 The maximum number of raster map layers that can be queried at one time
199 is 400.
200
202 · Fix 400 maps limit
203
205 r.category, r.report, r.stats, r.series, r.univar, v.what,
206 v.what.rast, v.what.vect
207
209 Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
210 Vector point input added by Martin Landa, Czech Technical University in
211 Prague, Czech Republic
212
214 Available at: r.what source code (history)
215
216 Main index | Raster index | Topics index | Keywords index | Graphical
217 index | Full index
218
219 © 2003-2019 GRASS Development Team, GRASS GIS 7.8.2 Reference Manual
220
221
222
223GRASS 7.8.2 r.what(1)