1r.slope.aspect(1) GRASS GIS User's Manual r.slope.aspect(1)
2
3
4
6 r.slope.aspect - Generates raster maps of slope, aspect, curvatures
7 and partial derivatives from an elevation raster map.
8 Aspect is calculated counterclockwise from east.
9
11 raster, terrain, aspect, slope, curvature, parallel
12
14 r.slope.aspect
15 r.slope.aspect --help
16 r.slope.aspect [-aen] elevation=name [slope=name] [aspect=name]
17 [format=string] [precision=string] [pcurvature=name] [tcurva‐
18 ture=name] [dx=name] [dy=name] [dxx=name] [dyy=name]
19 [dxy=name] [zscale=float] [min_slope=float] [nprocs=integer]
20 [memory=memory in MB] [--overwrite] [--help] [--verbose] [--quiet]
21 [--ui]
22
23 Flags:
24 -a
25 Do not align the current region to the raster elevation map
26
27 -e
28 Compute output at edges and near NULL values
29
30 -n
31 Create aspect as degrees clockwise from North (azimuth), with flat
32 = -9999
33 Default: degrees counter-clockwise from East, with flat = 0
34
35 --overwrite
36 Allow output files to overwrite existing files
37
38 --help
39 Print usage summary
40
41 --verbose
42 Verbose module output
43
44 --quiet
45 Quiet module output
46
47 --ui
48 Force launching GUI dialog
49
50 Parameters:
51 elevation=name [required]
52 Name of input elevation raster map
53
54 slope=name
55 Name for output slope raster map
56
57 aspect=name
58 Name for output aspect raster map
59
60 format=string
61 Format for reporting the slope
62 Options: degrees, percent
63 Default: degrees
64
65 precision=string
66 Type of output aspect and slope maps
67 Storage type for resultant raster map
68 Options: CELL, FCELL, DCELL
69 Default: FCELL
70 CELL: Integer
71 FCELL: Single precision floating point
72 DCELL: Double precision floating point
73
74 pcurvature=name
75 Name for output profile curvature raster map
76
77 tcurvature=name
78 Name for output tangential curvature raster map
79
80 dx=name
81 Name for output first order partial derivative dx (E-W slope)
82 raster map
83
84 dy=name
85 Name for output first order partial derivative dy (N-S slope)
86 raster map
87
88 dxx=name
89 Name for output second order partial derivative dxx raster map
90
91 dyy=name
92 Name for output second order partial derivative dyy raster map
93
94 dxy=name
95 Name for output second order partial derivative dxy raster map
96
97 zscale=float
98 Multiplicative factor to convert elevation units to horizontal
99 units
100 Default: 1.0
101
102 min_slope=float
103 Minimum slope value (in percent) for which aspect is computed
104 Default: 0.0
105
106 nprocs=integer
107 Number of threads for parallel computing
108 Default: 1
109
110 memory=memory in MB
111 Maximum memory to be used (in MB)
112 Cache size for raster rows
113 Default: 300
114
116 r.slope.aspect generates raster maps of slope, aspect, curvatures and
117 first and second order partial derivatives from a raster map of true
118 elevation values. The user must specify the input elevation raster map
119 and at least one output raster maps. The user can also specify the for‐
120 mat for slope (degrees, percent; default=degrees), and the zscale: mul‐
121 tiplicative factor to convert elevation units to horizontal units; (de‐
122 fault 1.0).
123
124 The elevation input raster map specified by the user must contain true
125 elevation values, not rescaled or categorized data. If the elevation
126 values are in other units than in the horizontal units, they must be
127 converted to horizontal units using the parameter zscale. In GRASS GIS
128 7, vertical units are not assumed to be meters any more. For example,
129 if both your vertical and horizontal units are feet, parameter zscale
130 must not be used.
131
132 The aspect output raster map indicates the direction that slopes are
133 facing counterclockwise from East: 90 degrees is North, 180 is West,
134 270 is South, 360 is East. Zero aspect indicates flat areas with zero
135 slope. Category and color table files are also generated for the aspect
136 raster map.
137 Note: These values can be transformed to azimuth values (90 is East,
138 180 is South, 270 is West, 360 is North) using r.mapcalc:
139 # convert angles from CCW from East to CW from North
140 # modulus (%) can not be used with floating point aspect values
141 r.mapcalc "azimuth_aspect = if(ccw_aspect == 0, 0, \
142 if(ccw_aspect < 90, 90 - ccw_aspect, \
143 450 - ccw_aspect)))"
144 Alternatively, the -n flag can be used to produce aspect as degrees CW
145 from North. Aspect for flat areas is then set to -9999 (default: 0).
146 Note: The reason for using -9999 is to be compliant with gdaldem which
147 uses -9999 by default as the nodata value.
148
149 The aspect for slope equal to zero (flat areas) is set to zero (-9999
150 with -n flag). Thus, most cells with a very small slope end up having
151 category 0, 45, ..., 360 in aspect output. It is possible to reduce the
152 bias in these directions by filtering out the aspect in areas where the
153 terrain is almost flat. A option min_slope can be used to specify the
154 minimum slope for which aspect is computed. For all cells with
155 slope < min_slope, both slope and aspect are set to zero.
156
157 The slope output raster map contains slope values, stated in degrees of
158 inclination from the horizontal if format=degrees option (the default)
159 is chosen, and in percent rise if format=percent option is chosen.
160 Category and color table files are generated.
161
162 Profile and tangential curvatures are the curvatures in the direction
163 of steepest slope and in the direction of the contour tangent respec‐
164 tively. The curvatures are expressed as 1/metres, e.g. a curvature of
165 0.05 corresponds to a radius of curvature of 20m. Convex form values
166 are positive and concave form values are negative.
167
168 Example DEM
169
170 Slope (degree) from example DEM Aspect (degree) from example DEM
171
172 Tangential curvature (m-1) from example DEM Profile curvature (m-1) from example DEM
173
174
175 For some applications, the user will wish to use a reclassified raster
176 map of slope that groups slope values into ranges of slope. This can be
177 done using r.reclass. An example of a useful reclassification is given
178 below:
179 category range category labels
180 (in degrees) (in percent)
181 1 0- 1 0- 2%
182 2 2- 3 3- 5%
183 3 4- 5 6- 10%
184 4 6- 8 11- 15%
185 5 9- 11 16- 20%
186 6 12- 14 21- 25%
187 7 15- 90 26% and higher
188 The following color table works well with the above
189 reclassification.
190 category red green blue
191 0 179 179 179
192 1 0 102 0
193 2 0 153 0
194 3 128 153 0
195 4 204 179 0
196 5 128 51 51
197 6 255 0 0
198 7 0 0 0
199
201 To ensure that the raster elevation map is not inappropriately resam‐
202 pled, the settings for the current region are modified slightly (for
203 the execution of the program only): the resolution is set to match the
204 resolution of the elevation raster map and the edges of the region
205 (i.e. the north, south, east and west) are shifted, if necessary, to
206 line up along edges of the nearest cells in the elevation map. If the
207 user really wants the raster elevation map resampled to the current re‐
208 gion resolution, the -a flag should be specified.
209
210 The current mask is ignored.
211
212 The algorithm used to determine slope and aspect uses a 3x3 neighbor‐
213 hood around each cell in the raster elevation map. Thus, slope and as‐
214 pect are not determineed for cells adjacent to the edges and NULL cells
215 in the elevation map layer. These cells are by default set to nodata in
216 output raster maps. With the -e flag, output values are estimated for
217 these cells, avoiding cropping along the edges.
218
219 Horn’s formula is used to find the first order derivatives in x and y
220 directions.
221
222 Only when using integer elevation models, the aspect is biased in 0,
223 45, 90, 180, 225, 270, 315, and 360 directions; i.e., the distribution
224 of aspect categories is very uneven, with peaks at 0, 45,..., 360 cate‐
225 gories. When working with floating point elevation models, no such as‐
226 pect bias occurs.
227
228 PERFORMANCE
229 To enable parallel processing, the user can specify the number of
230 threads to be used with the nprocs parameter (default 1). The memory
231 parameter (default 300) can also be provided to determine the size of
232 the buffer for computation.
233 Figure: Benchmark on the left shows execution time for different number
234 of cells, benchmark on the right shows execution time for different
235 memory size for 5000x5000 raster. See benchmark scripts in source code.
236 (Intel Core i9-10940X CPU @ 3.30GHz x 28)
237
238 To reduce the memory requirements to minimum, set option memory to
239 zero. To take advantage of the parallelization, GRASS GIS needs to
240 compiled with OpenMP enabled.
241
243 Calculation of slope, aspect, profile and tangential curvature
244 In this example a slope, aspect, profile and tangential curvature map
245 are computed from an elevation raster map (North Carolina sample
246 dataset):
247 g.region raster=elevation
248 r.slope.aspect elevation=elevation slope=slope aspect=aspect pcurvature=pcurv tcurvature=tcurv
249 # set nice color tables for output raster maps
250 r.colors -n map=slope color=sepia
251 r.colors map=aspect color=aspectcolr
252 r.colors map=pcurv color=curvature
253 r.colors map=tcurv color=curvature
254
255 Figure: Slope, aspect, profile and tangential curvature raster map
256 (North Carolina dataset)
257
258 Classification of major aspect directions in compass orientation
259 In the following example (based on the North Carolina sample dataset)
260 we first generate the standard aspect map (oriented CCW from East),
261 then convert it to compass orientation, and finally classify four major
262 aspect directions (N, E, S, W):
263 g.region raster=elevation -p
264 # generate integer aspect map with degrees CCW from East
265 r.slope.aspect elevation=elevation aspect=myaspect precision=CELL
266 # generate compass orientation and classify four major directions (N, E, S, W)
267 r.mapcalc "aspect_4_directions = eval( \\
268 compass=(450 - myaspect ) % 360, \\
269 if(compass >=0. && compass < 45., 1) \\
270 + if(compass >=45. && compass < 135., 2) \\
271 + if(compass >=135. && compass < 225., 3) \\
272 + if(compass >=225. && compass < 315., 4) \\
273 + if(compass >=315., 1) \\
274 )"
275 # assign text labels
276 r.category aspect_4_directions separator=comma rules=- << EOF
277 1,north
278 2,east
279 3,south
280 4,west
281 EOF
282 # assign color table
283 r.colors aspect_4_directions rules=- << EOF
284 1 253,184,99
285 2 178,171,210
286 3 230,97,1
287 4 94,60,153
288 EOF
289 Aspect map classified to four major compass directions (zoomed subset
290 shown)
291
293 • Horn, B. K. P. (1981). Hill Shading and the Reflectance Map,
294 Proceedings of the IEEE, 69(1):14-47.
295
296 • Mitasova, H. (1985). Cartographic aspects of computer surface
297 modeling. PhD thesis. Slovak Technical University , Bratislava
298
299 • Hofierka, J., Mitasova, H., Neteler, M., 2009. Geomorphometry
300 in GRASS GIS. In: Hengl, T. and Reuter, H.I. (Eds), Geomor‐
301 phometry: Concepts, Software, Applications. Developments in
302 Soil Science, vol. 33, Elsevier, 387-410 pp, http://www.geomor‐
303 phometry.org
304
306 r.mapcalc, r.neighbors, r.reclass, r.rescale
307
309 Michael Shapiro, U.S.Army Construction Engineering Research Laboratory
310 Olga Waupotitsch, U.S.Army Construction Engineering Research Laboratory
311
313 Available at: r.slope.aspect source code (history)
314
315 Accessed: Saturday Oct 28 18:17:58 2023
316
317 Main index | Raster index | Topics index | Keywords index | Graphical
318 index | Full index
319
320 © 2003-2023 GRASS Development Team, GRASS GIS 8.3.1 Reference Manual
321
322
323
324GRASS 8.3.1 r.slope.aspect(1)