Note: This document is for an older version of GRASS GIS that is outdated. You should upgrade, and read the current manual page.

GRASS logo

NAME

v.what.rast - Uploads raster values at positions of vector points to the table.

KEYWORDS

vector, raster, attribute table, sampling

SYNOPSIS

v.what.rast
v.what.rast help
v.what.rast [-ip] vector=name raster=name [layer=integer] [column=string] [where=sql_query] [--verbose] [--quiet]

Flags:

-i
Interpolate values from the nearest four cells
-p
Print categories and values instead of updating the database
--verbose
Verbose module output
--quiet
Quiet module output

Parameters:

vector=name
Name of input vector points map for which to edit attribute table
raster=name
Name of existing raster map to be queried
layer=integer
Layer number
A single vector map can be connected to multiple database tables. This number determines which table to use.
Default: 1
column=string
Column name (will be updated by raster values)
where=sql_query
WHERE conditions of SQL statement without 'where' keyword
Example: income < 1000 and inhab >= 10000

DESCRIPTION

v.what.rast reads the raster value for each point in the vector map and updates column in the vector attribute table by this value. The column should be type number (integer, float, double, ... ).

If the -p flag is used, then the attribute table is not updated and the results are printed to stdout.

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

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 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

A) 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:
v.what.rast vector=pnts raster=elevation column=heights

B) In case of a vector map without attached attribute table, first add a new attribute table. This table is then populated with values queried from the raster map:

# create new random vector points map
v.random pnts n=100

# add new table, link to map
v.db.addtable pnts column="heights double precision"

# query raster map and upload values to vector table into specified column
g.region rast=elevation -p
v.what.rast vector=pnts raster=elevation column=heights

# verify new attribute table:
v.db.select pnts

# verify statistics of uploaded values:
v.univar map=pnts column=heights type=point

SEE ALSO

v.db.addtable, v.db.select, v.drape, v.univar, v.rast.stats, v.what.rast.buffer (AddOn module), v.what.vect

AUTHORS

Radim Blazek
Hamish Bowman (interpolation)

Last changed: $Date: 2013-11-14 01:34:55 -0800 (Thu, 14 Nov 2013) $


Main index - vector index - Full index

© 2003-2014 GRASS Development Team