GRASS logo

Note: A new GRASS GIS stable version has been released: GRASS GIS 7, available here. And see the new manual page here


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


vector, raster, attribute table


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


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


v.what.rast reads raster value for each point in the vector and updates col column in vector attribute table by this value. The column should be type number (integer, float, double, ... ).
If more points have the same category, attribute value is set to NULL. If raster values is NULL, attribute value is set to NULL.


v.what.rast operates on the attribute table. To modify the vector geometry instead, use v.drape.


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 vect=pnts rast=elevation col=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 col="heights double precision"

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

# verify new attribute table: pnts

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


v.db.addtable,, v.drape, v.univar, v.rast.stats, v.what.vect


Radim Blazek

Last changed: $Date: 2012-02-08 13:39:58 -0800 (Wed, 08 Feb 2012) $

Main index - vector index - Full index

© 2003-2016 GRASS Development Team