# gdal_sieve.py

removes small raster polygons

## SYNOPSIS

    gdal_sieve.py [-q] [-st threshold] [-4] [-8] [-o name=value]
               srcfile [-nomask] [-mask filename] [-of format] [dstfile]

## 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.

-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.

-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).

-mask filename:

  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.

-of format:

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

Generated for GDAL by 1.7.1.