GDAL_SIEVE(1)

πŸ’– GDAL_SIEVE(1) β€” the GDAL manual page, bestie edition πŸ’–

okay so you opened the GDAL manual and landed on gdal_sieve, and honestly? you're in the right place. this is the group chat rundown. pull up a chair 🫢


✨ NAME ✨

gdal_sieve β€” removes small raster polygons. that's it. that's the whole job. tiny polygons? gone. ✨


πŸŽ€ SYNOPSIS πŸŽ€

gdal_sieve [--help] [--help-general]
              [-q] [-st threshold] [-4] [-8] [-o name=value]
              <srcfile> [-nomask] [-mask filename] [-of format] [<dstfile>]

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe: gdal_sieve goes through your raster, finds polygons that are smaller than a threshold size you give it (measured in pixels), and replaces them with the pixel value of the largest neighbour polygon. it's giving "you don't fit the aesthetic, the biggest polygon next door is adopting you". πŸ’…

the result can be written back into the existing raster band, or copied into a new file β€” your call, you have options.

important: the input dataset is read as integer data, which literally means floating point values get rounded to integers. so if your source data needs re-scaling, do that first β€” some cases need it (e.g. 32-bit floating point data with min=0 and max=1). no cap. πŸ™ˆ

if you want the full algorithm lore, additional details live in the GDALSieveFilter() docs. go read them, they ate. πŸ”₯

NOTE: gdal_sieve is a Python utility, and is only available if GDAL Python bindings are available. no bindings, no sieve. that's the rule bestie. 😭
TIP: Equivalent in new "gdal" command line interface: See gdal raster sieve.

🌸 OPTIONS 🌸

  • --help β€” show help, be helped πŸ’–
  • --help-general β€” show the general help, the broader lore
  • -q β€” quiet mode. shhh. 🀫
  • -st threshold β€” the threshold size in pixels. polygons smaller than this get sieved away. this is the main character of the whole operation πŸ‘‘
  • -4 β€” the four-bit(ish) flavour of the option set ✨
  • -8 β€” the eight-bit(ish) flavour of the option set ✨
  • -o name=value β€” pass a creation/config option as name=value
  • <srcfile> β€” the source file. your input. the raw material πŸ“
  • -nomask β€” don't use a mask
  • -mask filename β€” use filename as the mask
  • -of format β€” output format
  • <dstfile> β€” the destination file. optional! if you skip it (and skip writing back to the band) it's your business, but the synopsis says it's allowed to be absent πŸŽ€

🌈 RETURN STATUS CODE 🌈

  • the program returns status code 0 in case of success βœ…
  • and non-zero in case of error ❌
  • but lowkey: non-blocking errors emitted as warnings are considered as a successful execution. so warning-zone stuff still counts as a win πŸ’€βœ¨

πŸ’œ AUTHOR πŸ’œ

Frank Warmerdam <warmerdam@pobox.com> β€” legend behaviour, honestly 🫢


1998-2026


and that's the whole page bestie, we ate and left no crumbs πŸ§šπŸ’… this was GDAL_SIEVE(1) from the GDAL manual, dated Aug 18, 2026 β€” go sieve something small, periodt. πŸŒΈπŸ’–

πŸ“¦ where this page comes from