gdal_sieve.py

SYNOPSIS

DESCRIPTION

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.

Additional details on the algorithm are available in the GDALSieveFilter() docs.

-q:

The script runs in quiet mode. The progress monitor is suppressed and routine messages are not displayed.

-stthreshold:

Set the size threshold in pixels. Only raster polygons smaller than this size will be removed.

-oname=value:

Specify a special argument to the algorithm. Currently none are supported.

-4:

Four connectedness should be used when determining polygons. That is diagonal pixels are not considered directly connected. This is the default.

-8:

Eight connectedness should be used when determining polygons. That is diagonal pixels are considered directly connected.

srcfile

The source raster file used to identify target pixels. Only the first band is used.

-nomask:

Do not use the default validity mask for the input band (such as nodata, or alpha masks).

-maskfilename:

Use the first band of the specified file as a validity mask (zero is invalid, non-zero is valid).

dstfile

The new file to create with the filtered result. If not provided, the source band is updated in place.

-offormat:

Select the output format. The default is GeoTIFF (GTiff). Use the short format name.