[GRASS-dev] hints appreciated for work on a r.zonal.geometry module

Moritz Lennert mlennert at club.worldonline.be
Mon Jun 20 09:40:01 PDT 2016


Hi,

While work is ongoing concerning improving r.to.vect performance [1], I 
am looking at the possibility of creating an r.zonal.geometry module 
which would calculate a series of form statistics for raster zones (aka 
clumps). I would begin simply by trying to replicate the v.to.db 
statistics, i.e. area and perimeter, with compactness and fractal 
dimension derived from the two former.

Area calculation is quite simple (and already exists, for example, in 
r.stats.zonal with the count method). However, perimeter is a bit more 
complicated. My current idea is to 'simply' fetch raster info into a SEG 
structure and to check for each pixel whether the upper, lower, left and 
right neighbor has the same cat value as the current pixel. For each 
neighbor where this is not the case, I add one pixel edge to the total 
zonal perimeter.

Does this sound like the correct approach. Is there some already 
existing code that I don't know about that already does this ?

Just trying to avoid reinventing the wheel.

My current motivation is to allow a complete OBIA toolchain without 
going through vectorization at any point. At this stage, both 
i.segment.stats and v.area.stats require the vectorization of raster 
zones for shape statistics which makes the process very slow.

Moritz


[1] https://trac.osgeo.org/grass/ticket/2045


More information about the grass-dev mailing list