[GRASS-user] calculating statistics based upon a raster patch map

Glynn Clements glynn at gclements.plus.com
Thu Nov 20 10:07:38 EST 2008


Hufkens Koen wrote:

> I've got two maps, a map with patches or areas which I want to evaluate.
> A second map contains a parameter which I want to evaluate (average,
> std) based upon areas as delineated in the first map. The output of all
> this would optimally be a third map with the results of the evaluation
> (average, std) given to the areas of the first map.
> 
> Is this possible in a simple way, or should I write something myself. I
> can't seem to find a premade function that does this or something close
> to it.

r.statistics does this, but both inputs have to be integer raster
maps.

In 7.0-svn, r.statistics2 and r.statistics3 provide similar
functionality, but allow the cover map to be floating-point.

If your base map is a vector map, you can convert it with v.to.rast.

If you need aggregates other than those provided by r.statistics etc,
then you can to use r.stats (with the restriction that both maps must
be integers) to collate the data into tuples of (base category, cover
value, count), and calculate the aggregates with e.g. awk.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list