r.slope.aspect.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <h2>DESCRIPTION</h2>
  2. <em>r.slope.aspect</em> generates raster maps of slope, aspect, curvatures and
  3. first and second order partial derivatives from a raster map of true
  4. elevation values. The user must specify the input <b>elevation</b> raster map
  5. and at least one output raster maps. The user can also specify the
  6. <b>format</b> for slope (degrees, percent; default=degrees), and the
  7. <b>zscale</b>: multiplicative factor to convert elevation units to horizontal units;
  8. (default 1.0).
  9. <p>
  10. The <b>elevation</b> input raster map specified by the user must contain true
  11. elevation values, <em>not</em> rescaled or categorized data. If the elevation
  12. values are in other units than in the horizontal units,
  13. they must be converted to horizontal units using the parameter <b>zscale</b>.
  14. <em>In GRASS GIS 7, vertical units are not assumed to be meters any more.
  15. For example, if both your vertical and horizontal units are feet,
  16. parameter <b>zscale</b> must not be used</em>.
  17. <p>
  18. The <b>aspect</b> output raster map indicates the direction that slopes
  19. are facing counterclockwise from East: 90 degrees is North, 180 is
  20. West, 270 is South, 360 is East. Zero aspect indicates flat areas with
  21. zero slope. Category and color table files are also generated for the
  22. aspect raster map. <br> Note: These values can be transformed to
  23. azimuth values (90 is East, 180 is South, 270 is West, 360 is North)
  24. using <a href="r.mapcalc.html">r.mapcalc</a>:
  25. <div class="code"><pre>
  26. # convert angles from CCW from East to CW from North
  27. # modulus (%) can not be used with floating point aspect values
  28. r.mapcalc "azimuth_aspect = if(ccw_aspect == 0, 0, \
  29. if(ccw_aspect < 90, 90 - ccw_aspect, \
  30. 450 - ccw_aspect)))"
  31. </pre></div>
  32. Alternatively, the <b>-n</b> flag can be used to produce aspect as
  33. degrees CW from North. Aspect for flat areas is then set to -9999
  34. (default: 0). Note: The reason for using -9999 is to be compliant with
  35. <b>gdaldem</b> which uses -9999 by default as the nodata value.
  36. <p>
  37. The aspect for slope equal to zero (flat areas) is set to zero (-9999
  38. with <b>-n</b> flag). Thus, most cells with a very small slope end up
  39. having category 0, 45, ..., 360 in <b>aspect</b> output. It is possible
  40. to reduce the bias in these directions by filtering out the aspect in
  41. areas where the terrain is almost flat. A option <b>min_slope</b> can
  42. be used to specify the minimum slope for which aspect is computed. For
  43. all cells with slope&nbsp;&lt;&nbsp;<b>min_slope</b>, both slope and
  44. aspect are set to zero.
  45. <center>
  46. <img src="aspect_diagram.png" border="0">
  47. </center>
  48. <p>
  49. The <b>slope</b> output raster map contains slope values, stated in degrees of
  50. inclination from the horizontal if <b>format</b>=degrees option (the default)
  51. is chosen, and in percent rise if <b>format</b>=percent option is chosen.
  52. Category and color table files are generated.
  53. <p>
  54. Profile and tangential curvatures are the curvatures in the direction of
  55. steepest slope and in the direction of the contour tangent respectively. The
  56. curvatures are expressed as 1/metres, e.g. a curvature of 0.05 corresponds to a
  57. radius of curvature of 20m. Convex form values are positive and concave form values
  58. are negative.
  59. <p><table width="100%" border="0">
  60. <tr valign="baseline">
  61. <td>
  62. <center>
  63. <img src="dem.png" border="1">
  64. <p> Example DEM
  65. <br><br>
  66. </center>
  67. </td>
  68. <td>
  69. </td>
  70. </tr>
  71. <tr valign="baseline">
  72. <td>
  73. <center>
  74. <img src="slope.png" border="1">
  75. <p> Slope (degree) from example DEM
  76. <br><br>
  77. </center>
  78. </td>
  79. <td>
  80. <center>
  81. <img src="aspect.png" border="1">
  82. <p> Aspect (degree) from example DEM
  83. <br><br>
  84. </center>
  85. </td>
  86. </tr>
  87. <tr valign="baseline">
  88. <td>
  89. <center>
  90. <img src="tcurv.png" border="1">
  91. <p> Tangential curvature (m<sup>-1</sup>) from example DEM
  92. <br><br>
  93. </center>
  94. </td>
  95. <td>
  96. <center>
  97. <img src="pcurv.png" border="1">
  98. <p> Profile curvature (m<sup>-1</sup>) from example DEM
  99. <br><br>
  100. </center>
  101. </td>
  102. <td>
  103. </td>
  104. </tr>
  105. </table>
  106. <p>For some applications, the user will wish to use a reclassified raster map
  107. of slope that groups slope values into ranges of slope. This can be done using
  108. <em><a href="r.reclass.html">r.reclass</a></em>. An example of a useful
  109. reclassification is given below:
  110. <div class="code"><pre> category range category labels
  111. (in degrees) (in percent)
  112. 1 0- 1 0- 2%
  113. 2 2- 3 3- 5%
  114. 3 4- 5 6- 10%
  115. 4 6- 8 11- 15%
  116. 5 9- 11 16- 20%
  117. 6 12- 14 21- 25%
  118. 7 15- 90 26% and higher
  119. The following color table works well with the above
  120. reclassification.
  121. category red green blue
  122. 0 179 179 179
  123. 1 0 102 0
  124. 2 0 153 0
  125. 3 128 153 0
  126. 4 204 179 0
  127. 5 128 51 51
  128. 6 255 0 0
  129. 7 0 0 0</pre></div>
  130. <h2>NOTES</h2>
  131. To ensure that the raster elevation map is not inappropriately resampled,
  132. the settings for the current region are modified slightly (for the execution
  133. of the program only): the resolution is set to match the resolution of
  134. the elevation raster map and the edges of the region (i.e. the north, south, east
  135. and west) are shifted, if necessary, to line up along edges of the nearest
  136. cells in the elevation map. If the user really wants the raster elevation map
  137. resampled to the current region resolution, the <b>-a</b> flag should be specified.
  138. <p>
  139. The current mask is ignored.
  140. <p>
  141. The algorithm used to determine slope and aspect uses a 3x3
  142. neighborhood around each cell in the raster elevation map. Thus,
  143. slope and aspect are not determineed for cells adjacent to
  144. the edges and NULL cells in the elevation map layer. These cells are
  145. by default set to nodata in output raster maps. With the <b>-e</b> flag,
  146. output values are estimated for these cells, avoiding cropping along
  147. the edges.
  148. <p>
  149. Horn's formula is used to find the first order derivatives in x and y directions.
  150. <p>
  151. Only when using integer elevation models, the aspect is biased in 0,
  152. 45, 90, 180, 225, 270, 315, and 360 directions; i.e., the distribution
  153. of aspect categories is very uneven, with peaks at 0, 45,..., 360 categories.
  154. When working with floating point elevation models, no such aspect bias occurs.
  155. <h3>PERFORMANCE</h3>
  156. To enable parallel processing, the user can specify the number of threads to be
  157. used with the <b>nprocs</b> parameter (default 1). The <b>memory</b> parameter
  158. (default 300) can also be provided to determine the size of the buffer for
  159. computation.
  160. <div align="center" style="margin: 10px">
  161. <img src="r_slope_aspect_benchmark_size.png" alt="benchmark for number of cells" border="0">
  162. <img src="r_slope_aspect_benchmark_memory.png" alt="benchmark for memory size" border="0">
  163. <br>
  164. <i>Figure: Benchmark on the left shows execution time for different
  165. number of cells, benchmark on the right shows execution time
  166. for different memory size for 5000x5000 raster. See benchmark scripts in source code.
  167. (Intel Core i9-10940X CPU @ 3.30GHz x 28) </i>
  168. </div>
  169. <p>To reduce the memory requirements to minimum, set option <b>memory</b> to zero.
  170. To take advantage of the parallelization, GRASS GIS
  171. needs to compiled with OpenMP enabled.
  172. <h2>EXAMPLES</h2>
  173. <h3>Calculation of slope, aspect, profile and tangential curvature</h3>
  174. In this example a slope, aspect, profile and tangential curvature map
  175. are computed from an elevation raster map (North Carolina sample
  176. dataset):
  177. <div class="code"><pre>
  178. g.region raster=elevation
  179. r.slope.aspect elevation=elevation slope=slope aspect=aspect pcurvature=pcurv tcurvature=tcurv
  180. # set nice color tables for output raster maps
  181. r.colors -n map=slope color=sepia
  182. r.colors map=aspect color=aspectcolr
  183. r.colors map=pcurv color=curvature
  184. r.colors map=tcurv color=curvature
  185. </pre></div>
  186. <center>
  187. <img src="r_slope_aspect_slope.png" border="0">
  188. <img src="r_slope_aspect_aspect.png" border="0">
  189. <img src="r_slope_aspect_pcurv.png" border="0">
  190. <img src="r_slope_aspect_tcurv.png" border="0">
  191. <p>
  192. Figure: Slope, aspect, profile and tangential curvature raster map (North Carolina dataset)
  193. </center>
  194. <h3>Classification of major aspect directions in compass orientation</h3>
  195. In the following example (based on the North Carolina sample dataset)
  196. we first generate the standard aspect map (oriented CCW from East), then
  197. convert it to compass orientation, and finally classify four major aspect
  198. directions (N, E, S, W):
  199. <div class="code"><pre>
  200. g.region raster=elevation -p
  201. # generate integer aspect map with degrees CCW from East
  202. r.slope.aspect elevation=elevation aspect=myaspect precision=CELL
  203. # generate compass orientation and classify four major directions (N, E, S, W)
  204. r.mapcalc "aspect_4_directions = eval( \\
  205. compass=(450 - myaspect ) % 360, \\
  206. if(compass >=0. && compass < 45., 1) \\
  207. + if(compass >=45. && compass < 135., 2) \\
  208. + if(compass >=135. && compass < 225., 3) \\
  209. + if(compass >=225. && compass < 315., 4) \\
  210. + if(compass >=315., 1) \\
  211. )"
  212. # assign text labels
  213. r.category aspect_4_directions separator=comma rules=- << EOF
  214. 1,north
  215. 2,east
  216. 3,south
  217. 4,west
  218. EOF
  219. # assign color table
  220. r.colors aspect_4_directions rules=- << EOF
  221. 1 253,184,99
  222. 2 178,171,210
  223. 3 230,97,1
  224. 4 94,60,153
  225. EOF
  226. </pre></div>
  227. <center>
  228. <img src="r_slope_aspect_4_directions.png" alt="Aspect map classified to four major compass directions"><br>
  229. Aspect map classified to four major compass directions (zoomed subset shown)
  230. </center>
  231. <h2>REFERENCES</h2>
  232. <ul>
  233. <li> Horn, B. K. P. (1981). <i>Hill Shading and the Reflectance Map</i>, Proceedings
  234. of the IEEE, 69(1):14-47.
  235. <li> Mitasova, H. (1985). <i>Cartographic aspects of computer surface modeling. PhD thesis.</i>
  236. Slovak Technical University , Bratislava
  237. <li> Hofierka, J., Mitasova, H., Neteler, M., 2009. <i>Geomorphometry in GRASS GIS.</i>
  238. In: Hengl, T. and Reuter, H.I. (Eds), <i>Geomorphometry: Concepts, Software, Applications. </i>
  239. Developments in Soil Science, vol. 33, Elsevier, 387-410 pp,
  240. <a href="http://www.geomorphometry.org">http://www.geomorphometry.org</a>
  241. </ul>
  242. <h2>SEE ALSO</h2>
  243. <em>
  244. <a href="r.mapcalc.html">r.mapcalc</a>,
  245. <a href="r.neighbors.html">r.neighbors</a>,
  246. <a href="r.reclass.html">r.reclass</a>,
  247. <a href="r.rescale.html">r.rescale</a>
  248. </em>
  249. <h2>AUTHORS</h2>
  250. Michael Shapiro, U.S.Army Construction Engineering Research Laboratory<br>
  251. Olga Waupotitsch, U.S.Army Construction Engineering Research Laboratory