[GRASS-user] Fill holes with an area bigger of a specific value in a raster coverage

Markus Neteler neteler at osgeo.org
Tue Apr 29 13:07:50 PDT 2014

On Tue, Apr 29, 2014 at 6:48 PM, Jorge Arevalo
<jorgearevalo at libregis.org> wrote:
> I want to fill some areas of a raster coverage with a value of my choice.
> Those areas now contain NODATA values. So, they look like holes in my
> coverage.

If you want to set all NODATA area to the same value, then use r.null
with null=yourvalue:


> I know I could use r.clump function , but I don't know how to specify the
> maximum area. Because if a hole is bigger than that area, I don't want to
> consider it as hole. Is that even possible with GRASS?

You could assign all NODATA areas a specific, yet unused value (see above).
Then extract this value with r.mapcalc (if condition) and extract from
the resulting map only the smaller areas with


Then merge them back with r.patch into the original maps in order to
create the final map.

Maybe there are other possibilities, too.


More information about the grass-user mailing list