I was running a gdal slope calculation on DEM I had

gdaldem slope B:/data.tif G:/slope.tif -of GTiff -b 1 -s 1.0

and I need to find the concert documentation on how the slope is calculated. https://gdal.org/programs/gdaldem.html I do not see it on the GDAL documentation.

I am looking for technical documentation on how each cell receives a slope value. Something like this for ESRI http://desktop.arcgis.com/en/arcmap/10.3/tools/spatial-analyst-toolbox/how-slope-works.htm has very detailed explanation on how slope is calculated

  • with GDAL you can read the source code and be certain on how it is implemented.
    – Ian Turton
    Dec 6, 2019 at 14:51

1 Answer 1


According to the end of the documentation of gdaldem, the code is an adaptation of the GRASS GIS approach, which is reasonably well documented here.

The central elements are (taken close to verbatim from the GRASS GIS documentation):

The aspect for slope equal to zero (flat areas) is set to zero (-9999 with -n flag). Thus, most cells with a very small slope end up having category 0, 45, ..., 360 in aspect output. It is possible to reduce the bias in these directions by filtering out the aspect in areas where the terrain is almost flat. A option min_slope can be used to specify the minimum slope for which aspect is computed. For all cells with slope < min_slope, both slope and aspect are set to zero.

Direction angle mappings.

The slope output raster map contains slope values, stated in degrees of inclination from the horizontal if format=degrees option (the default) is chosen, and in percent rise if format=percent option is chosen. Category and color table files are generated.

Profile and tangential curvatures are the curvatures in the direction of steepest slope and in the direction of the contour tangent respectively. The curvatures are expressed as 1/metres, e.g. a curvature of 0.05 corresponds to a radius of curvature of 20m. Convex form values are positive and concave form values are negative.

Example DEM
Example DEM.

Slope of Example DEM
Slope of example DEM.

For some applications, the user will wish to use a reclassified raster map of slope that groups slope values into ranges of slope. This can be done using r.reclass. An example of a useful reclassification is given below:

      category      range   category labels
                 (in degrees)    (in percent)

         1         0-  1             0-  2%
         2         2-  3             3-  5%
         3         4-  5             6- 10%
         4         6-  8            11- 15%
         5         9- 11            16- 20%
         6        12- 14            21- 25%
         7        15- 90            26% and higher

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.