GDAL-RASTER-SLOPE(1)
π gdal-raster-slope β Generate a slope map π
okay so welcome to the GDAL-RASTER-SLOPE(1) manual page bestie, this is the GDAL family's slope machine and honestly? she's iconic β¨
π Added in version 3.11. so she's new-ish and we love that for us π¦
β¨ SYNOPSIS β¨
Usage: gdal raster slope [OPTIONS] <INPUT> <OUTPUT>
Generate a slope map
Positional arguments:
-i, --input <INPUT> Input raster datasets [required] [not available in pipelines]
-o, --output <OUTPUT> Output raster dataset [required] [not available in pipelines]
Common Options:
-h, --help Display help message and exit
--json-usage Display usage as JSON document and exit
--config <KEY>=<VALUE> Configuration option [may be repeated]
-q, --quiet Quiet mode (no progress bar or warning message) [not available in pipelines]
Options:
-f, --of, --format, --output-format <OUTPUT-FORMAT> Output format ("GDALG" allowed) [not available in pipelines]
--co, --creation-option <KEY>=<VALUE> Creation option [may be repeated] [not available in pipelines]
--overwrite Whether overwriting existing output dataset is allowed [not available in pipelines]
Mutually exclusive with --append
--append Append as a subdataset to existing output [not available in pipelines]
Mutually exclusive with --overwrite
-b, --band <BAND> Input band (1-based index) (default: 1)
--unit <UNIT> Unit in which to express slopes. UNIT=degree|percent (default: degree)
--xscale <XSCALE> Ratio of vertical units to horizontal X axis units
--yscale <YSCALE> Ratio of vertical units to horizontal Y axis units
--gradient-alg <GRADIENT-ALG> Algorithm used to compute terrain gradient. GRADIENT-ALG=Horn|ZevenbergenThorne (default: Horn)
--no-edges Do not try to interpolate values at dataset edges or close to nodata values
Advanced Options:
--if, --input-format <INPUT-FORMAT> Input formats [may be repeated] [not available in pipelines]
--oo, --open-option <KEY>=<VALUE> Open options [may be repeated] [not available in pipelines]
π¬ the very same thing but in group-chat form
-i,--input <INPUT>β the input raster datasets. required, and she is not available in pipelines π«Ά-o,--output <OUTPUT>β where the output raster dataset goes. also required, also not available in pipelines β¨-h,--helpβ show the help message and dip out π--json-usageβ dump the usage as a JSON document and dip out π§--config <KEY>=<VALUE>β a configuration option, and yes you may repeat it π-q,--quietβ quiet mode, meaning no progress bar and no warning message. not available in pipelines π€«- and then all the real options below, keep scrolling π
πΈ DESCRIPTION πΈ
gdal raster slope generates a slope map, fr fr, from any GDAL-supported elevation raster. Like, any of them. Slay π
This subcommand is also available as a potential step of gdal raster pipeline π
It generates a 32-bit float raster with slope values. You get to pick the type of slope value you want: degrees or percent slope. And if the horizontal units differ from the vertical units? No worries bestie, you can also supply scaling factors to account for the difference between vertical and horizontal units π
The value -9999 is used as the output nodata value. A nodata value in the target dataset will be emitted if at least one pixel set to the nodata value is found in the 3x3 window centered around each source pixel. By default, the algorithm will compute values at image edges or if a nodata value is found in the 3x3 window, by interpolating missing values β unless --no-edges is specified, in which case a 1-pixel border around the image will be set with the nodata value. so, you know, pick your vibe π
In general, it assumes that x, y and z units are identical. However, if none of --xscale and --yscale are specified, and the CRS is a geographic or projected CRS, it will automatically determine the appropriate ratio from the units of the CRS, as well as the potential value of the units of the raster band (as returned by GDALRasterBand::GetUnitType(), if it is metre, foot international or US survey foot). Note that for geographic CRS, the result for source datasets at high latitudes may be incorrect, and prior reprojection to a polar projection might be needed using gdal raster reproject. okay that's the one caveat, don't skip it π
If x (east-west) and y (north-south) units are identical, but z (elevation) units are different, the --xscale and --yscale can be used to set the ratio of vertical units to horizontal. For geographic CRS near the equator, where units of latitude and units of longitude are similar, elevation (z) units can be converted to be compatible by using scale=370400 (if elevation is in feet) or scale=111120 (if elevation is in meters). For locations not near the equator, the --xscale value can be taken as the --yscale value multiplied by the cosine of the mean latitude of the raster πβ¨
π¦ GDALG OUTPUT (ON-THE-FLY / STREAMED DATASET) π¦
This program supports serializing the command line as a JSON file using the GDALG output format. The resulting file can then be opened as a raster dataset using the GDALG: GDAL Streamed Algorithm driver, and apply the specified pipeline in a on-the-fly / streamed way. lowkey magic β¨πͺ
π PROGRAM-SPECIFIC OPTIONS π
-b,--band <BAND>β Index (starting at1) of the band to which the slope must be computed π―--gradient-alg Horn|ZevenbergenThorneβ Algorithm used to compute terrain gradient. The default isHorn. The literature suggestsZevenbergen & Thorneto be more suited to smooth landscapes, whereasHorn's formula to perform better on rougher terrain. so like, smooth girlies vs rough girlies, both valid π--no-edgesβ Do not try to interpolate values at dataset edges or close to nodata values π«--unit degree|percentβ Unit in which to express slopes. Defaults todegree. π--xscale <scale>β Ratio of vertical units to horizontal X axis units. If the horizontal unit of the source DEM is degrees (e.g Lat/Long WGS84 projection), you can usescale=111120if the vertical units are meters (orscale=370400if they are in feet).
If none of --xscale and --yscale are specified, and the CRS is a geographic or projected CRS, gdal raster slope will automatically determine the appropriate ratio from the units of the CRS, as well as the potential value of the units of the raster band (as returned by GDALRasterBand::GetUnitType(), if it is metre, foot international or US survey foot). Note that for geographic CRS, the result for source datasets at high latitudes may be incorrect, and prior reprojection to a polar projection might be needed.
β οΈ If--xscaleis specified,--yscalemust also be specified. no solo acts, it's a duo π
--yscale <scale>β Ratio of vertical units to horizontal Y axis units. If the horizontal unit of the source DEM is degrees (e.g Lat/Long WGS84 projection), you can usescale=111120if the vertical units are meters (orscale=370400if they are in feet)
If none of --xscale and --yscale are specified, and the CRS is a geographic or projected CRS, gdal raster slope will automatically determine the appropriate ratio from the units of the CRS, as well as the potential value of the units of the raster band (as returned by GDALRasterBand::GetUnitType(), if it is metre, foot international or US survey foot). Note that for geographic CRS, the result for source datasets at high latitudes may be incorrect, and prior reprojection to a polar projection might be needed.
β οΈ If--yscaleis specified,--xscalemust also be specified. matching set or nothing π
β STANDARD OPTIONS β
--appendβ Append input raster as a new subdataset to an existing output file. Only works with drivers that support adding subdatasets such asGTiff-- GeoTIFF File Format andGPKG-- GeoPackage raster. This also creates the output dataset if it does not exist yet. she builds it if it's not there, self-sufficient queen π--co,--creation-option <NAME>=<VALUE>β Many formats have one or more optional creation options that can be used to control particulars about the file created. For instance, the GeoTIFF driver supports creation options to control compression, and whether the file should be tiled.
May be repeated. π
The creation options available vary by format driver, and some simple formats have no creation options at all. A list of options supported for a format can be listed with the --formats command line option but the documentation for the format is the definitive source of information on driver creation options. See Raster drivers format specific documentation for legal creation options for each format. β¨
--if,--input-format <format>β Format/driver name to be attempted to open the input file(s). It is generally not necessary to specify it, but it can be used to skip automatic driver detection, when it fails to select the appropriate driver. This option can be repeated several times to specify several candidate drivers. Note that it does not force those drivers to open the dataset. In particular, some drivers have requirements on file extensions. π«Ά
May be repeated. π
--oo,--open-option <NAME>=<VALUE>β Dataset open option (format specific). π§
May be repeated. π
-f,--of,--format,--output-format <OUTPUT-FORMAT>β Which output raster format to use. Allowed values may be given bygdal --formats | grep raster | grep rw | sortπ--overwriteβ Allow program to overwrite existing target file or dataset. Otherwise, by default,gdalerrors out if the target file or dataset already exists. she will NOT touch your existing file unless you say so π
π RETURN STATUS CODE π
The program returns status code 0 in case of success, and non-zero in case of error (non-blocking errors emitted as warnings are considered as a successful execution). so like, 0 = ate, non-zero = crying π
π EXAMPLES π
β¨ Example 1: Generates a slope map from a DTED0 file. β¨
$ gdal raster slope n43.dt0 out.tif --overwrite
one line, one slope map, no notes π
π AUTHOR π
Even Rouault <even.rouault@spatialys.com> β thank you icon π«Ά
πΈ COPYRIGHT πΈ
1998-2026
and that's the whole page bestie π¦ this was the GDAL-RASTER-SLOPE(1) manual from the GDAL source, dated Aug 18, 2026 β go make some slope maps, ily, periodt ππ
π¦ where this page comes from
- alpine 3.24: gdal-doc 3.13.3-r0 Β· MIT
- arch rolling: gdal 3.13.3-6 Β· MIT
- ubuntu stonking: gdal-bin 3.13.3+dfsg-1ubuntu4 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms