[GRASS-user] Zonal Raster Statistics with overlapping polygons

Leonardo leonardo at mobygis.com
Mon Feb 27 05:28:46 PST 2017


Thank you all for the detailed answers, also with attached example!

I totally agree with you, Moritz, about the "smart" and "clean" concept, 
the way GRASS
manage topology and the statistics in you example for polygon 1 and 2 is 
perfect
(it correctly takes into account overlapping areas), but the problem 
became with polygon 3.

Before posting the question I build an example similar to yours one,
but with only two overlapped polygons, polygon 1 has statistics calculated
over the whole area (also the overlapped part, like yours 1 and 2) but the
polygon two has only stats calculated over the non overlapped area (like 
your 3).
This behavior is perfectly coherent with the technical explanation given 
from
Sitansu, only the first polygon found in the rasterization is used,
then I am afraid that is not a bug as you suppose, but the behavior of 
v.rast.stats.

Martin, what a displeasure hear from you too that the only way is 
writing a loop,
thank you very much for sharing your script that does it!

Leonardo

On 27/02/2017 13:51, Martin Landa wrote:
> Hi,
>
> 2017-02-24 15:25 GMT+01:00 Gra <graziaz at gmail.com>:
>> I had a similar problem
>> I looped over the polygons (with a script)
> right, thats only way for overlapping polygons. Recently I wrote
> similar script to compute statistics for overlapping tiles (polygons)
> linked from PostGIS database [1]. (Link flag requires GRASS 7.3 -
> trunk). Ma
>
> [1] https://trac.osgeo.org/grass/browser/sandbox/martinl/tiles-rast-stats.py
>



More information about the grass-user mailing list