GRASS logo


r.slope.aspect - Generates raster map layers of slope, aspect, curvatures and partial derivatives from a raster map layer of true elevation values. Aspect is calculated counterclockwise from east.




r.slope.aspect help
r.slope.aspect [-aq] elevation=string [slope=string] [format=string] [prec=string] [aspect=string] [pcurv=string] [tcurv=string] [dx=string] [dy=string] [dxx=string] [dyy=string] [dxy=string] [zfactor=float] [min_slp_allowed=float] [--overwrite]


Do not align the current region to the elevation layer
Force overwrite of output files


Raster elevation file name
Output slope filename
Format for reporting the slope
Options: degrees,percent
Default: degrees
Type of output aspect and slope maps
Options: default,double,float,int
Default: float
Output aspect filename
Output profile curvature filename
Output tangential curvature filename
Output first order partial derivative dx (E-W slope) filename
Output first order partial derivative dy (N-S slope) filename
Output second order partial derivative dxx filename
Output second order partial derivative dyy filename
Output second order partial derivative dxy filename
Multiplicative factor to convert elevation units to meters
Default: 1.0
Minimum slope val. (in percent) for which aspect is computed
Default: 0.0


r.slope.aspect generates raster maps of slope, aspect, curvatures and first and second order partial derivatives from a raster map layer of true elevation values. The user must specify the input elevation file name and at least one output file name. The user can also specify the format for slope (degrees, percent; default=degrees), and zfactor: multiplicative factor to convert elevation units to meters; (default 1.0).


Do not align the settings of the current geographic region (to which the output slope and aspect map layers will be set) to those of the elevation layer. See NOTES.
The raster elevation map layer specified by the user must contain true elevation values, not rescaled or categorized data. If the elevation values are in feet or other units than meters (with a conversion factor defined in PROJ_UNITS), they must be converted to meters using the parameter zfactor.
The raster aspect map layer which is created indicates the direction that slopes are facing. The aspect categories represent the number degrees of east. Category and color table files are also generated for the aspect map layer. The aspect categories represent the number degrees of east and they increase counterclockwise: 90deg is North, 180 is West, 270 is South 360 is East, and the aspect value 0 is used to indicate undefined aspect in flat areas with slope=0.
The resulting raster slope map layer will contain slope values, stated in degrees of inclination from the horizontal if format=degrees option (which is also default ) is chosen, and in percent rise if format=percent option is chosen. The category file, but not the color table, is generated by r.slope.aspect for the raster slope map layer.Profile and tangential curvatures are the curvatures in the direction of steepest slope and in the direction of the contour tangent respectively.

For some applications, the user will wish to use a reclassified map layer 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

     The following color table works well with the above

          category   red   green   blue

             0       179    179     179
             1         0    102       0
             2         0    153       0
             3       128    153       0
             4       204    179       0
             5       128     51      51
             6       255      0       0
             7         0      0       0


To ensure that the raster elevation map layer is not inappropriately resampled, the settings for the current region are modified slightly (for the execution of the program only): the resolution is set to match the resolution of the elevation map and the edges of the region (i.e. the north, south, east and west) are shifted, if necessary, to line up along edges of the nearest cells in the elevation map. If the user really wants the elevation map resampled to the current region resolution, the -a flag should be specified.

The current mask, if set, is ignored.

The algorithm used to determine slope and aspect uses a 3x3 neighborhood around each cell in the elevation file. Thus, it is not possible to determine slope and aspect for the cells adjacent to the edges in the elevation map layer. These cells are assigned a "zero slope" value (category 0) in both the slope and aspect raster map layers.

Horn's formula is used to find the derivatives in x and y directions.

Only when using integer elevation models, the aspect is biased in 0, 45, 90, 180, 225, 270, 315, and 360 directions; i.e., the distribution of aspect categories is very uneven, with peaks at 0, 45,..., 360 categories.
Because most cells with a very small slope end up having category 0, 45,..., 360 it is sometimes possible to reduce bias in these directions by filtering out computation of aspect in areas where terrain is almost flat. The new option

was added (minimum slope for which aspect is computed). The aspect for all cells with slope < min_slp is set to 0 (no value).
When working with floating point elevation models, no such aspect bias occurs.


Horn, B. K. P. (1981). Hill Shading and the Reflectance Map, Proceedings of the IEEE, 69(1):14-47.


r.mapcalc, r.neighbors, r.reclass, r.rescale


Michael Shapiro, U.S.Army Construction Engineering Research Laboratory

Olga Waupotitsch, U.S.Army Construction Engineering Research Laboratory

Last changed: $Date: 2006/04/25 18:37:47 $

Main index - raster index - Full index