LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

gdal_contour

generates contour lines from elevation data

TLDR

Generate contours
$ gdal_contour -a [elev] -i [10] [dem.tif] [contours.shp]
copy
Specify interval
$ gdal_contour -i [100] [dem.tif] [contours.shp]
copy
Fixed contour levels
$ gdal_contour -fl [100] [500] [1000] [dem.tif] [contours.shp]
copy
Output to GeoJSON
$ gdal_contour -f "GeoJSON" -i [10] [dem.tif] [contours.geojson]
copy
Generate 3D contour polygons
$ gdal_contour -p -3d -a [elev] -i [50] [dem.tif] [contours.shp]
copy

SYNOPSIS

gdal_contour [options] input output

DESCRIPTION

gdal_contour generates contour lines from elevation rasters (DEMs). It creates vector features representing lines of equal elevation.The tool supports regular interval or specified level contours. Output includes elevation attributes for labeling. Multiple output formats are available.gdal_contour is used for cartography, terrain analysis, and visualization of elevation data.

PARAMETERS

INPUT

Input elevation raster (DEM).
OUTPUT
Output vector file.
-a NAME
Attribute name for elevation.
-i INTERVAL
Contour interval.
-fl LEVELS
Fixed contour levels.
-f FORMAT
Output format.
-b BAND
Source band number (default: 1).
-3d
Force production of 3D vectors instead of 2D.
-p
Generate contour polygons rather than contour lines.
-off OFFSET
Offset from zero relative to which to interpret intervals.
-snodata VALUE
Input nodata value to ignore.
-nln NAME
Output layer name.
-q
Quiet mode, suppress progress output.

CAVEATS

Quality depends on DEM resolution. Dense contours may be slow. Output size varies with complexity.

HISTORY

gdal_contour is part of GDAL (Geospatial Data Abstraction Library), providing contour generation from digital elevation models for mapping and analysis.

SEE ALSO

gdaldem(1), gdalinfo(1), ogr2ogr(1)

Copied to clipboard
Kai