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.
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.
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.
# work on copy of original geodetic points map g.copy vector=geodetic_pts,mygeodetic_pts # set computational region to raster map to be queried g.region raster=elev_state_500m -p # add new column to existing table v.db.addcolumn map=mygeodetic_pts column="height double precision" v.what.rast map=mygeodetic_pts raster=elev_state_500m column=height # compare official geodetic heights to those of elevation model v.db.select map=mygeodetic_pts columns=Z_VALUE,height separator=comma
# create new random vector points map v.random pnts n=100 # add new table, link to map v.db.addtable map=pnts column="height double precision" # set computational region to raster map to be queried g.region raster=elevation -p # query raster map and upload values to vector table into specified column v.what.rast map=pnts raster=elevation column=height # verify new attribute table: v.db.select pnts # verify statistics of uploaded values: v.univar map=pnts column=height type=point
Last changed: $Date: 2015-09-10 03:51:40 -0700 (Thu, 10 Sep 2015) $
© 2003-2018 GRASS Development Team, GRASS GIS 7.0.7svn Reference Manual