[GRASS5] New: v.rast.stats for vector/raster statistics

Markus Neteler neteler at itc.it
Wed Aug 24 19:15:42 EDT 2005


hi,

due to (my) floating point problems with r.average and friends and
for general convenience I have added a new script to calculate
raster stats based on vector objects: v.rast.stats.

Example (spearfish):

g.copy vect=roads,myroads
v.rast.stats vector=myroads rast=elevation.dem col=elev
v.info -c myroads
v.db.select myroads

# or:
v.db.select myroads > test.csv
openoffice test.csv

# sample query: what's the elevation range along the different street
# types in Spearfish area?
v.db.select myroads col=label,elev_range
label|elev_range
no data|
interstate|115.000000
primary highway, hard surface|398.000000
secondary highway, hard surface|431.000000
light-duty road, improved surface|656.000000
unimproved road|693.000000

-> Not suprisingly, we see that interstate doesn't vary that much.

# Other example: elevation statistics per field
v.rast.stats vector=fields rast=elevation.dem col=elev
v.info -c fields

#what's the elevation range of the area covered by field polygons?
v.univar map=fields column=elev_max
number of features with non NULL attribute: 126
number of missing attributes: 0
number of NULL attributes: 0
minimum: 1096
maximum: 1840
range: 744

cheers

 Markus




More information about the grass-dev mailing list