[GRASS-user] Obtain land use within 50 km buffers around vector points

Moritz Lennert mlennert at club.worldonline.be
Thu Jun 1 08:00:05 PDT 2017


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



More information about the grass-user mailing list