1v.what.rast(1) GRASS GIS User's Manual v.what.rast(1)
2
3
4
6 v.what.rast - Uploads raster values at positions of vector points to
7 the table.
8
10 vector, sampling, raster, position, querying, attribute table, surface
11 information
12
14 v.what.rast
15 v.what.rast --help
16 v.what.rast [-ip] map=name [layer=string] [type=string[,string,...]]
17 raster=name [column=name] [where=sql_query] [--help] [--verbose]
18 [--quiet] [--ui]
19
20 Flags:
21 -i
22 Interpolate values from the nearest four cells
23
24 -p
25 Print categories and values instead of updating the database
26
27 --help
28 Print usage summary
29
30 --verbose
31 Verbose module output
32
33 --quiet
34 Quiet module output
35
36 --ui
37 Force launching GUI dialog
38
39 Parameters:
40 map=name [required]
41 Name of vector points map for which to edit attributes
42 Or data source for direct OGR access
43
44 layer=string
45 Layer number or name
46 Vector features can have category values in different layers. This
47 number determines which layer to use. When used with direct OGR
48 access this is the layer name.
49 Default: 1
50
51 type=string[,string,...]
52 Input feature type
53 Options: point, centroid
54 Default: point
55
56 raster=name [required]
57 Name of existing raster map to be queried
58
59 column=name
60 Name of attribute column to be updated with the query result
61
62 where=sql_query
63 WHERE conditions of SQL statement without ’where’ keyword
64 Example: income < 1000 and population >= 10000
65
67 v.what.rast retrieves raster value from a given raster map for each
68 point or centroid stored in a given vector map. It can update a column
69 in the linked vector attribute table with the retrieved raster cell
70 value or print it.
71
72 The column type needs to be numeric (integer, float, double, ...). If
73 the column doesn’t exist in the vector attribute table than the module
74 will create the new column of type corresponding with the input raster
75 map.
76
77 If the -p flag is used, then the attribute table is not updated and the
78 results are printed to standard output.
79
80 If the -i flag is used, then the value to be uploaded to the database
81 is interpolated from the four nearest raster cells values using an
82 inverse distance weighting method (IDW). This is useful for cases when
83 the vector point density is much higher than the raster cell size.
84
86 Points and centroid with shared category number cannot be processed.
87 To solved this, unique categories may be added with v.category in a
88 separate layer.
89
90 If multiple points have the same category, the attribute value is set
91 to NULL. If the raster value is NULL, then attribute value is set to
92 NULL.
93
94 v.what.rast operates on the attribute table. To modify the vector geom‐
95 etry instead, use v.drape.
96
97 Categories and values are output unsorted with the print flag. To sort
98 them pipe the output of this module into the UNIX sort tool (sort -n).
99 If you need coordinates, after sorting use v.out.ascii and the UNIX
100 paste tool (paste -d’|’). In the case of a NULL result, a "*" will be
101 printed in lieu of the value.
102
103 The interpolation flag is only useful for continuous value raster maps,
104 if a categorical raster is given as input the results will be nonsense.
105 Since the search window is limited to four raster cells there may still
106 be raster cell-edge artifacts visible in the results, this compromise
107 has been made for processing speed. If one or more of the nearest four
108 raster cells is NULL, then only the raster cells containing values will
109 be used in the weighted average.
110
112 Transferring raster values into existing attribute table of vector points
113 map
114 Reading values from raster map at position of vector points, writing
115 these values into a column of the attribute table connected to the vec‐
116 tor map:
117
118 # work on copy of original geodetic points map
119 g.copy vector=geodetic_pts,mygeodetic_pts
120 # set computational region to raster map to be queried
121 g.region raster=elev_state_500m -p
122 # query raster cells (a new column will be added to existing table)
123 v.what.rast map=mygeodetic_pts raster=elev_state_500m column=height
124 # compare official geodetic heights to those of elevation model
125 v.db.select map=mygeodetic_pts columns=Z_VALUE,height separator=comma
126
127 Transferring raster values into new vector points map
128 In case of a vector map without attached attribute table, first add a
129 new attribute table. This table is then populated with values queried
130 from the raster map:
131
132 # create new random vector points map
133 v.random pnts n=100
134 # add new table, link to map
135 v.db.addtable map=pnts column="height double precision"
136 # set computational region to raster map to be queried
137 g.region raster=elevation -p
138 # query raster map and upload values to vector table into specified column
139 v.what.rast map=pnts raster=elevation column=height
140 # verify new attribute table:
141 v.db.select pnts
142 # verify statistics of uploaded values:
143 v.univar map=pnts column=height type=point
144
146 v.category, v.db.addtable, v.db.select, v.drape, v.univar,
147 v.rast.stats, v.what.vect
148
150 Radim Blazek
151 Hamish Bowman (interpolation)
152
154 Available at: v.what.rast source code (history)
155
156 Main index | Vector index | Topics index | Keywords index | Graphical
157 index | Full index
158
159 © 2003-2020 GRASS Development Team, GRASS GIS 7.8.5 Reference Manual
160
161
162
163GRASS 7.8.5 v.what.rast(1)