NAME
r.reclass.area.py - Reclasses a raster map greater or less than user specified area size (in hectares).
KEYWORDS
raster,
statistics,
aggregation
SYNOPSIS
r.reclass.area.py
r.reclass.area.py --help
r.reclass.area.py [-cdimv] input=name output=name [value=float] [mode=string] [lower=float] [upper=float] [method=string] [--overwrite] [--help] [--verbose] [--quiet] [--ui]
Flags:
- -c
- Input map is clumped
- -d
- Generate clumps including diagonal neighbors
- -i
- Invert filter (remove clumps larger than lower and smaller than upper)
- -m
- Apply lower area threshold as "minsize" during clumping
- -v
- Output vector map, do not convert back to raster (only for method 'rmarea')
- --overwrite
- Allow output files to overwrite existing files
- --help
- Print usage summary
- --verbose
- Verbose module output
- --quiet
- Quiet module output
- --ui
- Force launching GUI dialog
Parameters:
- input=name [required]
- Name of input raster map
- output=name [required]
- Name for output raster map
- value=float
- Value option that sets the area size limit (in hectares) (deprecated)
- mode=string
- Keep only areas lesser or greater than specified value (deprecated)
- Options: lesser, greater
- lower=float
- Value for the lower area size limit (in hectares). Pixel clumps with areas below this value are removed.
- upper=float
- Value for the upper area size limit (in hectares). Pixel clumps with areas above this value are removed.
- method=string
- Method used for area size filtering
- Options: reclass, rmarea
- Default: reclass
r.reclass.area removes areas (pixel clumps) from a raster
map that are smaller than a user specified
lower area
size and/or greater than a user-specified
upper
threshold (both in hectares).
r.reclass.area provides two
methods for
filtering:
- reclass - raster-based filtering
- rmarea - vector-based filtering
With the
reclass method, the input raster map is clumped and
then reclassified using the clump size. With the
-m
flag,
reclass method will remove small areas already during
clumping, using the
minsize option there. If the
-c flag is used,
r.reclass.area will skip the
creation of a clumped raster and assume that the input raster map is
already clumped.
The
rmarea method converts the raster map to vector and
removes areas outside the given thresholds using
v.clean and
v.edit. With
the
-v flag the
output is the filtered
vector map instead of a raster.
An important difference between the two methods with regard to
the
lower area size threshold is that
method=reclass deletes these areas, whereas
method=rmarea tries to merge these small areas
with a neighbouring larger area if existing. Details are explained in
v.clean describing the behaviour of
tool=rmarea.
In this example, the ZIP code map in the North Carolina sample dataset
is filtered for large areas (removing smaller areas from the map).
g.region raster=zipcodes -p
r.report zipcodes unit=h
Extract only areas greater than 2000 ha, NULL otherwise:
r.reclass.area input=zipcodes output=zipcodes_larger2000ha greater=2000
r.report zipcodes_larger2000ha unit=h
Figure: r.reclass.area method=reclass
In this example, the ZIP code map in the North Carolina sample dataset
is filtered for smaller areas which are substituted with the
value of the respective adjacent area with largest shared
boundary. Reclass by substitutional removing of areas smaller than 1000 ha:
r.reclass.area input=zipcodes output=zipcodes_minor1000ha mode=lesser value=1000 method=rmarea
Figure: r.reclass.area method=rmarea
r.clump,
r.reclass,
r.stats,
r.stats,
r.stats,
r.stats
NRCS,
Markus Neteler,
Stefan Blumentath
SOURCE CODE
Available at:
r.reclass.area source code
(history)
Latest change: Friday Aug 07 20:45:33 2026 in commit: 0850a40412c109476e3551dd90a17c99e45908ff
Main index |
Raster index |
Topics index |
Keywords index |
Graphical index |
Full index
© 2003-2026
GRASS Development Team,
GRASS 8.6.0dev Reference Manual