Forrest logo
tool overview
On this page you find all important commands for the CLI tool gdal_contour. If the command you are looking for is missing please ask our AI.


GDAL (Geospatial Data Abstraction Library) is a powerful command line tool widely used for processing and manipulating geospatial data. One of its functionalities is the gdal_contour tool, specifically designed for generating contour lines from raster datasets. Here are ten key points about gdal_contour:

  1. Purpose: The gdal_contour tool is primarily intended for extracting elevation data from digital elevation models (DEMs) and creating contour lines in various common formats like shapefile, KML, or DXF.

  2. Input data: It requires a raster dataset as input, such as a GeoTIFF or a similar grid-based elevation model. It supports multiple raster formats, allowing users to work with different types of elevation data.

  3. Contour line generation: The tool examines the raster data and generates lines connecting points of equal elevation, creating a contour map.

  4. Output formats: gdal_contour provides flexible options for choosing the output format for the generated contour lines, including shapefile, KML, DXF, or even raw text files.

  5. Contour interval and attributes: Users can specify the desired contour interval, allowing them to control the density and spacing of the contour lines. Additionally, it can optionally store the elevation values as attributes within the generated contour lines.

  6. Smoothing: The tool offers a smoothing capability to reduce the jaggedness of the generated contours. Smoothing can help create more visually pleasing and accurate representations of the terrain.

  7. Attribute values: Besides elevation, gdal_contour can also calculate other attributes for the contour lines, such as slope, aspect, or hillshade.

  8. Reprojection: The tool supports reprojection of both input raster dataset and output contour lines. This enables users to generate contours in different coordinate reference systems (CRS) or project the contours to match other geospatial data.

  9. Command line flexibility: gdal_contour is a command line tool, which means it can be easily incorporated into scripts or automated workflows. Its command line interface provides flexibility to set various parameters according to specific requirements.

  10. Open-source and widely adopted: GDAL, including the gdal_contour tool, is an open-source project that is widely adopted by the geospatial community. Its usage is not limited to a specific operating system, making it accessible to users on Windows, macOS, and Linux platforms.

List of commands for gdal_contour:

  • gdal_contour:tldr:0ac3c gdal_contour: Create a vector dataset with contour lines spread over an 100-meter [i]nterval while [a]ttributing the elevation property as "ele".
    $ gdal_contour -a ${ele} -i ${100-0} ${path-to-input-tif} ${path-to-output-gpkg}
    try on your machine
    explain this command
  • gdal_contour:tldr:9836c gdal_contour: Create a vector dataset with [p]olygons spread over an 100-meter [i]nterval.
    $ gdal_contour -i ${100-0} -p ${path-to-input-tif} ${path-to-output-gpkg}
    try on your machine
    explain this command
tool overview