[GRASS-user] merging small areas but keep raster categories

Ken Mankoff mankoff at gmail.com
Sun Mar 10 04:15:42 PDT 2019


Hi Stefan,

I just solved this with the following and was replying to my own message when yours came in.

r.clump -d input=basins output=basins_nosmall minsize=123
r.mode base=basins_nosmall cover=basins output=basins_merged

On 2019-03-10 at 12:06 +0100, Stefan Blumentrath <Stefan.Blumentrath at nina.no> wrote...
> Did you try the rmarea method for r.reclass.area? That converts to
> vector, runs v.clean with rmarea and then converts back to raster (if
> I understood correctly...

The issue with rmarea is I don't want to remove small areas, I want to merge them with larger ones. If there is an island of only small ones, they are all dropped because there is nothing large to attach them to.

The r.clump code I use above correctly merges them into one, and then the r.mode line re-assigns the most common (largest area) original category value. The latter (keeping the main category value) was what I was having trouble with when I wrote my original message.

Thank you for thinking about the issue and replying,

  -k.



More information about the grass-user mailing list