Forrest logo
back to the gdal_contour tool

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

The command "gdal_contour" is used to generate vector contour lines from raster datasets. Here is the breakdown of the command:

  • "gdal_contour": This is the name of the utility or tool being executed.

  • "-i ${100-0}": This option specifies the interval between contour lines. The syntax "${100-0}" means subtraction operation, where contour lines will be generated every 100 units starting from 0. For example, if the elevation values in the input raster vary from 0 to 1000, the command will generate contour lines at 0, 100, 200, ..., 1000.

  • "-p ${path-to-input-tif}": This option specifies the path to the input raster file (.tif) from which the contour lines will be generated. "${path-to-input-tif}" indicates that you need to replace it with the actual file path.

  • "${path-to-output-gpkg}": This specifies the path to the output file or the destination where the generated contour lines will be saved. "${path-to-output-gpkg}" indicates that you should replace it with the desired output file path and filename. The file format used here is GeoPackage (.gpkg), but other formats such as Shapefile (.shp) can also be used.

In summary, this command will create contour lines at specific intervals from the input raster file and save the resulting vector data to a GeoPackage file.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the gdal_contour tool