# [R] Slope of surface

Roger Bivand Roger.Bivand at nhh.no
Wed Oct 20 13:13:49 CEST 2004

```On Wed, 20 Oct 2004, Barry Rowlingson wrote:

> (Ted Harding) wrote:
> > On 19-Oct-04 Laura Quinn wrote:
> >
> >>Is there a neat way of working out the slope of a flat surface in R?
>
> >>Given (x,y,z) co-ordinates of the four corners of a square, is there a
> >>function which will allow me to calculate the "mean" slope of the
> >>surface in a given direction?
>
>   I had a quick look at the help for r.slope.aspect for the GRASS GIS
> [1]. To compute the slope of a raster grid it uses 'Horn's Formula' [2]
> which it says works by taking the 3x3 neighbourhood of the cell in
> question. If you really want a slope map over a big grid, this might be
> a better way to do it.

Yes, a more recent paper runs different methods against each other (Jones,
K. H. 1998. A comparison of algorithms used to compute hill slope as a
property of the DEM. Computers & Geosciences 24 (4), 315-323.), and finds
that the method due to Zevenbergen & Thorne (Zevenbergen, L. W., Thorne,
C. R. 1987. Quantitative analysis of land surface topography. Earth
Surface Processes and Landforms, 12 (1), 47-56.) is generally pretty good,
based on the same 3x3 moving window. The DEM will usually then give you
not only slope and aspect, but also plane and profile curvature. As far as
I remember, the algorithm is described in Burrough & McDonnell Principles
of GIS (1998). This lecture page is quite informative:

http://www.geog.ubc.ca/courses/geog516/talks_2001/slope_calculation.html

slope "in a given direction", though - all these methods give slope in the
aspect direction, not at an arbitrary angle.

Roger

>
>
> Barry
>
>
> [1]
> http://supportweb.cs.bham.ac.uk/documentation/grass5/html/r.slope.aspect.html
>
> [2] Horn, B. K. P. (1981). Hill Shading and the Reflectance Map,
> Proceedings of the IEEE, 69(1):14-47.
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
>

--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of