[GRASS-dev] module for collecting percentages of raster classes in a vector map

Moritz Lennert mlennert at club.worldonline.be
Mon Jul 2 09:21:16 PDT 2018


Hi everyone,

I have a vague memory that someone has coded this before, but cannot
find it anywhere, but before I code it myself I wanted to know if my
vague memory actually was right: I need a module that takes a
qualitative raster map (e.g. land cover map) and a vector polygon map
and calculates the share of each raster class in each vector polygon.
This just means looping of the raster categories, create a reclass map
for each category (category = 1 and rest=null) and then use r.univar to
calculate non_null_cells/(non_null_cells+null_cells), so it's fairly
easy to code, but even so, does anyone know if something like this
already exists, before I reinvent the wheel ?

Moritz


More information about the grass-dev mailing list