<div dir="ltr"><div>Dear all, <br></div><div><br></div><div>thanks again for your answers. I found an easier way, use -c flag in v.in.ogr seems to not build topology of overlapping areas and then v.rast.stats does not complain. <br></div><div><br></div><div>However, if one builds buffer areas for points within GRASS, i.e., using v.buffer, the problem appears again when buffer areas overlap, which it's pretty common when creating buffers around neighbouring points. Then, to get zonal stats for those areas the approach suggested by Markus Metz should be followed. I believe it is a bit of an overkill for such a common task in GIS. Couldn't v.buffer have a -c flag as v.in.ogr so when overlapping of buffer areas is fine the topology is not built and one would get just one area per input point? Would that be possible?</div><div><br></div><div>cheers, <br></div><div>Vero<br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El jue., 16 may. 2019 a las 11:27, Moritz Lennert (<<a href="mailto:mlennert@club.worldonline.be">mlennert@club.worldonline.be</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 16/05/19 03:11, Veronica Andreo wrote:<br>
> Dear all,<br>
> <br>
> thanks for the answers...<br>
> <br>
> @Madi, I know, but that's how I got the data from a colleague using <br>
> SaTScan to get cluster sizes.<br>
> <br>
> So, these "clusters" are 3, they are represented by circular areas and 2 <br>
> of them overlap, and it is just fine that they overlap. I just want one <br>
> centroid per area to be able to get one value per original area.<br>
> <br>
> I tested your solution, @Micha (thanks much for your time!), but it <br>
> gives me 4 values, and I need 3. Moreover, I can no longer recognize <br>
> which polygon is which since v.db.select for layer 3 reports cats from 1 <br>
> to 4, but d.vect shows something different (I'd assume 2/3 has become <br>
> 4?). See screenshot below.<br>
<br>
To see the cat values of layer 3 you have to indicate that layer in the <br>
label_layer parameter (Labels tab).<br>
<br>
You can also see the correspondance between the two layers with<br>
<br>
v.category polys_3layers op=print layer=1,3<br>
<br>
> <br>
> So, is it possible somehow to keep my 3 original polygons? And how can I <br>
> get raster values for my original 3 polygons in GRASS? Or is it that <br>
> this is not allowed by topology?<br>
<br>
This depends on how you want to get raster values. If v.what.rast at the <br>
location of the centroid is all you need than Micha's solution should work.<br>
<br>
If you need v.rast.stats then you either have to use Markus' suggestion, <br>
or you use Micha's approach running v.rast.stats on layer three and then <br>
use some magic to transform the output of the above v.category call to a <br>
correspondance table between layer. Something like this<br>
<br>
import grass.script as g<br>
for feature in g.read_command('v.category',<br>
                              input_='polys_3layers',<br>
                              op='print',<br>
                               layer=[3,1]).splitlines():<br>
      cat1 = feature.split('|')[0]<br>
      cats2 = feature.split('|')[1].split('/')<br>
      for cat2 in cats2:<br>
          print cat1, cat2<br>
<br>
This correspondance table could then be used to aggregate the raster <br>
stats per (original) polygon in SQL. This could be the easily put into <br>
an addon module.<br>
<br>
Moritz<br>
<br>
</blockquote></div>