gdal_sieve man page
gdal_sieveRemoves small raster polygons.
gdal_sieve.py [-q] [-st threshold] [-4] [-8] [-o name=value] srcfile [-nomask] [-mask filename] [-of format] [dstfile]
The gdal_sieve.py script removes raster polygons smaller than a provided threshold size (in pixels) and replaces replaces them with the pixel value of the largest neighbour polygon. The result can be written back to the existing raster band, or copied into a new file.
The input dataset is read as integer data which means that floating point values are rounded to integers. Re-scaling source data may be necessary in some cases (e.g. 32-bit floating point data with min=0 and max=1).
Additional details on the algorithm are available in the GDALSieveFilter() docs.
The script runs in quiet mode. The progress monitor is suppressed and routine messages are not displayed.
- -st threshold:
Set the size threshold in pixels. Only raster polygons smaller than this size will be removed.
- -o name=value:
Specify a special argument to the algorithm. Currently none are supported.
Four connectedness should be used when determining polygons. That is diagonal pixels are not considered directly connected. This is the default.
Eight connectedness should be used when determining polygons. That is diagonal pixels are considered directly connected.
The source raster file used to identify target pixels. Only the first band is used.
Do not use the default validity mask for the input band (such as nodata, or alpha masks).
- -mask filename:
Use the first band of the specified file as a validity mask (zero is invalid, non-zero is valid).
The new file to create with the filtered result. If not provided, the source band is updated in place.
- -of format:
Select the output format. Starting with GDAL 2.3, if not specified, the format is guessed from the extension (previously was GTiff). Use the short format name.
Frank Warmerdam firstname.lastname@example.org