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

Martin Wegmann martin.wegmann at uni-wuerzburg.de
Thu Nov 20 08:09:55 EST 2008

On Donnerstag, 20. November 2008 13:57:42 Hufkens Koen wrote:
> Hi list,
> 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.

it is quit simple: 

1) change your 'patch map' with r.to.vect and v.to.rast into individually 
numbered patches

2) change your value_raster to integer and multiplication (e.g. '*100') is 
advisable: r.mapcalc "tmp1=int(value_raster*100)"

3) query your raster:
 r.statistics  base=patch_raster cover=tmp1 method=average 
out=value_raster --o

4) perhaps use r.mapcalc to revert the *100 modification in the new map

regards, Martin


University of Wuerzburg
Institute of Geography
Department of Remote Sensing
Remote Sensing and Biodiversity Unit
Am Hubland
97074 Wuerzburg, Germany
German Aerospace Center (DLR)
German Remote Sensing Data Center (DFD)

Phone:  +49-(0)931-888-4797
Fax:    +49-(0)931-888-4961
Email:  martin.wegmann at uni-wuerzburg.de
url: http://www.remote-sensing.uni-wuerzburg.de


More information about the grass-user mailing list