v.rast.stats(1)

NAME
v.rast.stats - Calculates univariate statistics from a GRASS raster map based on vector objects

KEYWORDS
vector, raster, statistics

SYNOPSIS
v.rast.stats
v.rast.stats help
v.rast.stats [-c] vector=string raster=string colprefix=string

  Flags:

-c  continue if upload column(s) already exist

  Parameters:

vector=string
    Name of vector polygon map

raster=string
    Name of raster map to calculate statistics from

colprefix=string
    column prefix for new attribute columns

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

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

EXAMPLES
Example to upload DEM statistics to vector field patches:
# work on copy of original map:
g.copy vect=fields,myfields
# 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
v.db.select myfields

SEE ALSO
r.univar, v.univar

AUTHOR
Markus Neteler

Last changed: $Date: 2005/11/10 11:29:49 $

Full index