[GRASS-user] how to count number of occurrences of a specific category value in the neighborhood of a given pixel

Hamish hamish_b at yahoo.com
Wed Nov 23 18:36:09 EST 2011


Marcello wrote:
> As always, there is surely a better way in GRASS
> (probably one single command),

"many roads lead to Rome" as the saying goes..

> but you could binarize your map (1 for your
> desired category and zero for everything else)

for this step, r.reclass will make things much
faster and save disk space too.


> and then use r.neighbors method=sum 
> size=desired_neighborhood. 
>
> The result would be the desired count.


Hamish


More information about the grass-user mailing list