v.what.rast.multi
Uploads values of multiple rasters at positions of vector points to the table.
v.what.rast.multi [-im] map=name [layer=string] [type=string [,string,...]] raster=name [,name,...] [columns=name] [where=sql_query] [--verbose] [--quiet] [--qq] [--ui]
Example:
v.what.rast.multi map=name raster=name
grass.script.run_command("v.what.rast.multi", map, layer="1", type="point", raster, columns=None, where=None, flags=None, verbose=False, quiet=False, superquiet=False)
Example:
gs.run_command("v.what.rast.multi", map="name", raster="name")
Parameters
map=name [required]
Name of vector points map for which to edit attributes
Or data source for direct OGR access
layer=string
Layer number or name
Vector features can have category values in different layers.
Default: 1
type=string [,string,...]
Input feature type
Allowed values: point, centroid
Default: point
raster=name [,name,...] [required]
Name of existing raster map to be queried
columns=name
Names of attribute columns to be updated with the query result
where=sql_query
WHERE conditions of SQL statement without 'where' keyword
Example: income < 1000 and population >= 10000
-i
Interpolate values from the nearest four cells
-m
Retain mapset name
When no column names are provided, the column names are created using the names of the input layers. Using this flag will retain the mapset part of the name (if given), but replacing the @ for an underscore.
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--qq
Very quiet module output
--ui
Force launching GUI dialog
map : str, required
Name of vector points map for which to edit attributes
Or data source for direct OGR access
Used as: input, vector, name
layer : str, optional
Layer number or name
Vector features can have category values in different layers.
Used as: input, layer
Default: 1
type : str | list[str], optional
Input feature type
Allowed values: point, centroid
Default: point
raster : str | list[str], required
Name of existing raster map to be queried
Used as: input, raster, name
columns : str, optional
Names of attribute columns to be updated with the query result
Used as: input, dbcolumn, name
where : str, optional
WHERE conditions of SQL statement without 'where' keyword
Example: income < 1000 and population >= 10000
Used as: sql_query
flags : str, optional
Allowed values: i, m
i
Interpolate values from the nearest four cells
m
Retain mapset name
When no column names are provided, the column names are created using the names of the input layers. Using this flag will retain the mapset part of the name (if given), but replacing the @ for an underscore.
verbose: bool, optional
Verbose module output
Default: False
quiet: bool, optional
Quiet module output
Default: False
superquiet: bool, optional
Very quiet module output
Default: False
DESCRIPTION
v.what.rast.multi retrieves raster value from a given set of raster map for each point or centroid stored in a given vector map. It can update a column in the linked vector attribute table with the retrieved raster cell value or print it. It is essentially a wrapper around v.what.rast.
The column type needs to be numeric (integer, float, double, ...). If the column doesn't exist in the vector attribute table than the module will create the new column of type corresponding with the input raster map.
If the -p flag is used, then the attribute table is not updated and the results are printed to standard output.
If the -i flag is used, then the value to be uploaded to the database is interpolated from the four nearest raster cells values using an inverse distance weighting method (IDW). This is useful for cases when the vector point density is much higher than the raster cell size.
NOTES
Points and centroid with shared category number cannot be processed. To solved this, unique categories may be added with v.category in a separate layer.
If multiple points have the same category, the attribute value is set to NULL. If the raster value is NULL, then attribute value is set to NULL.
v.what.rast.multi operates on the attribute table. To modify the vector geometry instead, use v.drape.
Categories and values are output unsorted with the print flag. To sort
them pipe the output of this module into the UNIX sort
tool
(sort -n
). If you need coordinates, after sorting use
v.out.ascii
and the UNIX paste
tool (paste -d'|'
). In the case of a NULL result,
a "*
" will be printed in lieu of the value.
The interpolation flag is only useful for continuous value raster maps, if a categorical raster is given as input the results will be nonsense. Since the search window is limited to four raster cells there may still be raster cell-edge artifacts visible in the results, this compromise has been made for processing speed. If one or more of the nearest four raster cells is NULL, then only the raster cells containing values will be used in the weighted average.
EXAMPLES
Transferring raster values into existing attribute table of vector points map
Reading values from raster map at position of vector points, writing these values into a column of the attribute table connected to the vector map:
# set computational region
g.region raster=slope -p
# work on copy of original geodetic points map
g.copy vector=geodetic_pts,mygeodetic_pts
# query raster cells
v.what.rast.multi map=mygeodetic_pts raster=elev_state_500m,slope,aspect columns=elevation,slope,aspect
# print results
v.db.select map=mygeodetic_pts columns=elevatin,slope,aspect separator=comma where="SLOPE > 0"
SEE ALSO
AUTHOR
Pierre Roudier
SOURCE CODE
Available at: v.what.rast.multi source code
(history)
Latest change: Thursday Feb 20 13:02:26 2025 in commit 53de819