v.rast.stats - Calculates univariate statistics from a GRASS raster map based on vector polygons and uploads statistics to new attribute columns
vector, raster, statistics
v.rast.stats [-c] vector=name raster=name colprefix=string
- continue if upload column(s) already exist
- Name of vector polygon map
- Name of raster map to calculate statistics from
- Column prefix for new attribute columns
v.rast.stats - Calculates basic univariate statistics from
a raster map only for the parts covered by the specified vector map.
The vector map will be rasterized according to the raster map resolution.
Then univariate statistics are calculated per vector category (cat) from
the raster map and the results uploaded to the vector map attribute table.
New columns are generated in the attribute table if not already present.
Six columns are generated (n, min, max, range, mean, stddev, variance,
coeff_var, sum) according to the output of r.univar.
Unless not specified, the script stops if a (prefixed) upload column is already
present in the vector map attribute table.
If a MASK is present, it will be restored after the script finished.
The scripts changes temporarily to the resolution of the given raster map.
Example to upload DEM statistics to vector field patches:
# work on copy of original map:
# if needed, zoom to raster map:
g.region rast=elevation.dem -p
# calculate DEM statistics, upload to vector map table:
v.rast.stats myfields raster=elevation.dem colprefix=dem
# verify results:
v.info -c myfields
Last changed: $Date: 2005/11/10 11:29:49 $
Main index - vector index - Full index