GDAL
gdal_contour

Builds vector contour lines from a raster elevation model.

SYNOPSIS

Usage: 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>] [-p]
                    <src_filename> <dst_filename>

DESCRIPTION

This program generates a vector contour file from the input raster elevation model (DEM).

Starting from version 1.7 the contour line-strings will be oriented consistently. The high side will be on the right, i.e. a line string goes clockwise around a top.

-b band:

picks a particular band to get the DEM from. Defaults to band 1.

-a name:

provides a name for the attribute in which to put the elevation. If not provided no elevation attribute is attached.

-amin name:

(Since GDAL 2.4) 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.

-amax name:

(Since GDAL 2.4) provides a name for the attribute in which to put the maximum elevation of contour polygon. If not provided no maximim elevation attribute is attached.

-3d:

Force production of 3D vectors instead of 2D. Includes elevation at every vertex.

-inodata:

Ignore any nodata value implied in the dataset - treat all values as valid.

-snodata value:

Input pixel value to treat as "nodata".

-f format:

Create output in a particular format. Starting with GDAL 2.3, 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:

(Since GDAL 2.4) will generate levels on an exponential scale: base ^ k, for k an integer.

-nln outlayername:

Provide a name for the output vector layer. Defaults to "contour".

-p:

(Since GDAL 2.4) Generate contour polygons rather than contour lines.

C API

Functionality of this utility can be done from C with GDALContourGenerate().

EXAMPLE

This would create 10meter 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

Generated for GDAL by doxygen 1.8.13.