[GRASS-user] Aggregate a classification map according to a vector file

Markus Metz markus.metz.giswork at googlemail.com
Mon Jan 18 07:52:35 EST 2010



Pedro Roma wrote:
> Greetings all
> As far as I can see, r.statistics 
> (http://grass.itc.it/grass64/manuals/html64_user/r.statistics.html) 
> uses as cover and as basis a RASTER map. But, "All cells in the base 
> layer are considered one object for the analysis". This is not what I 
> want because I want base layer to be a polygon not a cell. Or Am I 
> reading this wrong?
You're right, but you can easily convert vector to raster. In this case, 
first set the region to match your cover map, then something like
v.to.rast type=area
then r.statistics

v.what.rast also converts the vector to a raster first, then runs 
statistics. v.what.rast would be the best solution unless you want the 
most frequent category.

Markus M

>
> On Sat, Jan 16, 2010 at 9:59 AM, Markus Metz 
> <markus.metz.giswork at googlemail.com 
> <mailto:markus.metz.giswork at googlemail.com>> wrote:
>
>
>     Markus Neteler wrote:
>
>         Pedro Roma wrote:
>          
>
>             Greetings all
>             A few emails that people sent, regarding classigication
>             operations GRASS
>             were extremely helpful :)
>             But now, I have one question:
>             I need to do some aggregation of the classification map
>             according to regions
>             specified in a vector file. What I mean is, for each
>             county I need to have
>             an aggregation of all classified pixels in order to have
>             only one value that
>             represents that county.
>             E.g. I have a land cover classification for my region and
>             now I need to
>             aggregate the classified map according to my counties in
>             order to have a
>             vector map in which each county is represented by its more
>             frequent
>             classification.
>             Is this possible in GRASS? Was I clear :D ?
>                
>
>
>         Could this be of interest?
>         Addons: r.univar.zonal
>         http://svn.osgeo.org/grass/grass-addons/raster/r.univar2.zonal/r.univar.zonal.html
>          
>
>     Or r.statistics with method=mode, gives you the most frequent
>     value in cover map for each value in base map. AFAIK,
>     r.univar[.zonal] doesn't have modal as output.
>
>     Markus M
>
>


More information about the grass-user mailing list