GDAL_CONTOUR(1)

πŸ“¦
version 3.4.3 Β· 2 versions
, in epel 9

πŸ’– NAME πŸ’–

gdal_contour β€” okay bestie, this one builds vector contour lines from a raster elevation model. It's the GDAL_CONTOUR(1) page, and it's lowkey iconic for turning your DEM into contour realness πŸ’…βœ¨

✨ SYNOPSIS ✨

gdal_contour [-b <band>] [-a <attribute_name>] [-amin <attribute_name>] [-amax <attribute_name>]
             [-3d] [-inodata]
             [-snodata n] [-i <interval>]
             [-f <formatname>] [[-dsco NAME=VALUE] ...] [[-lco NAME=VALUE] ...]
             [-off <offset>] [-fl <level> <level>...] [-e <exp_base>]
             [-nln <outlayername>] [-q] [-p]
             <src_filename> <dst_filename>

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so the gdal_contour generates a vector contour file from the input raster elevation model (DEM). Main character energy for elevation data, fr fr.

The contour line-strings are oriented consistently, and the high side will be on the right β€” i.e. a line string goes clockwise around a top. Slay, consistent orientation βœ…

Now the options, every single one, no skipping:

  • -b <band> β€” picks a particular band to get the DEM from. Defaults to band 1. Choose your band, bestie πŸŽ€
  • -a <name> β€” provides a name for the attribute in which to put the elevation. If not provided no elevation attribute is attached. Ignored in polygonal contouring (-p) mode.
  • -amin <name> β€” provides a name for the attribute in which to put the minimum elevation of contour polygon. If not provided no minimum elevation attribute is attached. Ignored in default line contouring mode. New in version 2.4.0.
  • -amax <name> β€” provides a name for the attribute in which to put the maximum elevation of contour polygon. If not provided no maximum elevation attribute is attached. Ignored in default line contouring mode. New in version 2.4.0.
  • -3d β€” force production of 3D vectors instead of 2D. Includes elevation at every vertex. We love a little dimension πŸ’…
  • -inodata β€” ignore any nodata value implied in the dataset β€” treat all values as valid. No cap, everything counts 🫢
  • -snodata <value> β€” input pixel value to treat as "nodata".
  • -f <format> β€” create output in a particular format. New in version 2.3.0: if not specified, the format is guessed from the extension (previously was ESRI Shapefile).
  • -dsco <NAME=VALUE> β€” dataset creation option (format specific).
  • -lco <NAME=VALUE> β€” layer creation option (format specific).
  • -i <interval> β€” elevation interval between contours.
  • -off <offset> β€” offset from zero relative to which to interpret intervals.
  • -fl <level> β€” name one or more "fixed levels" to extract.
  • -e <base> β€” generate levels on an exponential scale: base ^ k, for k an integer. New in version 2.4.0.
  • -nln <name> β€” provide a name for the output vector layer. Defaults to "contour".
  • -p β€” generate contour polygons rather than contour lines. New in version 2.4.0.
  • -q β€” be quiet. Shhh, it's giving stealth mode 🀫

🌸 C API 🌸

Functionality of this utility can be done from C with GDALContourGenerate(). C girlies, this one's for you 🫢

πŸ“ EXAMPLE πŸ“

This would create 10-meter contours from the DEM data in dem.tif and produce a shapefile in contour.shp|shx|dbf with the contour elevations in the elev attribute.

gdal_contour -a elev dem.tif contour.shp -i 10.0

πŸ‘‘ AUTHOR πŸ‘‘

Frank Warmerdam <warmerdam@pobox.com>, Silke Reimer <silke@intevation.de> β€” iconic authors, no cap πŸ‘‘

1998-2026 β€” that's the copyright range, bestie πŸ’–


Final vibe check: source/version is GDAL, the page is GDAL_CONTOUR(1), and the date is Jan 08, 2026. Mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from