On 01/06/17 16:41, Moritz Lennert wrote:
Currently, the best way I see is to create a correspondance table
between the pieces and the original cat values. You can get that by running

v.category buffers op=add layer=2 out=buffers_2_layers

[...]

Then just run v.rast.stats once per class (each class raster can just be
a reclass of the original with classnum = 1\n* = NULL") on layer 2 of
the entire vector buffer map. Thus you will get the stats per piece of
buffer.

Instead of looping over the classes, you could also rasterize the layer 2 of buffers with v.to.rast [...] use=cat and then run r.stats on the two layers:

r.stats -c buffers,landuse

Add the results as another temporary table to the db and use it plus the correspondance table to fill your original table.

Moritz

_______________________________________________
grass-user mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to