[GRASSLIST:7900] Re: Slope and Aspect Algorithms in GRASS

Roger Bivand Roger.Bivand at nhh.no
Mon Aug 15 03:39:39 EDT 2005

On Sun, 14 Aug 2005, Dylan Beaudette wrote:

> Greetings,
> After reading a recent publication on the pros/cons of various algorithms for 
> calculating slope and aspect from gridded data [1], I became very curious 
> about which algorithms are implemented in some of the r.* and v.* commands . 
> A link to the science direct webpage and article text is included at the 
> bottom: note the long URL.
> For example, the following commands can generate slope and aspect maps:
> r.slope.aspect
> r.param.scale
> v.surf.rst
> r.resamp.rst
> According to the publication [1] , there are a number of ways in which slope 
> and aspect can be calculated (pages 4 - 6) : i.e. "three-point plane" , "four 
> closest neighbors" , "eight neighbors unweighted" ...
> According to the paper, the "eight neighbors unweighted" algorithm, was the 
> most robust (at least when tested with a Monte Carlo style error analysis) 
> for slope, aspect, and topographic index calculations.

Without checking, this looks like the result in 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.

I played with this some years ago, using r.mapcalc to build the eight 
neighbours from scratch for comparison with the other functions:

$ r.mapcalc 'z11 = topo[-1,-1]'

or similar.

(paper: http://www.nhh.no/geo/gib/gib1999/gib99-1/scangis.pdf)

> I looked through the source for r.slope.aspect, and could not determine which 
> method was being used.
> Do any of the developers know which algorithms are used for the various 
> commands mentioned above to calculate slope and aspect values?
> I think that it would be a good idea to:
> 1. document the slope/aspect algorithms being used in the various r.* commands
> 2. add some code to allow for different algorithms to be used (maybe just in 
> r.slope.aspect)

I quite agree that documentation is valuable, and that just sending 
readers to "Horn, B. K. P. (1981). Hill Shading and the Reflectance Map, 
Proceedings of the IEEE, 69(1):14-47." is a bit demanding for those 
without online library access - the same paper seems to be in  
GEO-PROCESSING 2 (1): 65& 1982 - and even with quite good university 
systems, I don't have even an abstract online.

In fact the Jones paper's abstract says:

"The calculation of hill slope in the form of downhill gradient and 
aspect for a point in a digital elevation model (DEM), is a popular 
procedure in the hydrological, environmental and remote sensing. The most 
commonly used slope calculation algorithms employed on DEM topography 
data make use of a three by three search window, or kernel, centred on 
the grid point (grid cell) in question in order to calculate the gradient 
and aspect at that point. A comparison of eight frequently used slope 
calculation algorithms for digital elevation matrices has been carried 
out using both synthetic and real data as test surfaces. Morrison's 
surface III, a trigonometrically defined surface, was used as the 
synthetic test surface. This was differentiated analytically to give true 
gradient and aspect values against which to compare the results of the 
tested algorithms. The results of the best-performing slope algorithm on 
Morrison's surface were then used as the reference against which to 
compare the other tested algorithms on a real DEM. For both of the test 
surfaces residual gradient and aspect grids were calculated by 
subtracting the gradient and aspect grids produced by the algorithms on 
test from the true/reference gradient and aspect grids. The resulting 
residual gradient and aspect grids were used to calculate 
root-mean-square (RMS) residual error estimates that were used to rank 
the slope algorithms from "best" (lowest value of RMS residual error) to 
"worst" (largest value of RMS residual error). For Morrison's test 
surface, Fleming and Hoffer's method gave the "best" results for both 
gradient and aspect. Horn's method (used in ArcInfo GRID) also performed 
well for both gradient and aspect estimation. However, the popular 
maximum downward gradient method (MDG) performed poorly, coming last in 
the rankings. A similar pattern was seen in the gradient and aspect 
rankings derived using the Rhum DEM, with Horn's method performing well 
and the MDG method poorly."

MDG is the eight neighbour method,  Zevenbergen and Thorne used in my 
paper is another version of Fleming and Hoffer (1979).

So maybe Horn isn't so bad?

The reference [1] is certainly interesting, and substantially updates 
Jones' conclusions.


> thanks!
> References:
> 1. Lynn D. Raaflaub and Michael J. Collins, The effect of error in gridded 
> digital elevation models on the estimation of topographic parameters, 
> Environmental Modelling & Software, In Press, Corrected Proof, Available 
> online 27 April 2005, .
> http://www.sciencedirect.com/science?_ob=GatewayURL&_method=citationSearch&_uoikey=B6VHC-4G1WYF2-1&_origin=SDEMFRASCII&_version=1&md5=ed8513abe73e9f178164c3bb35ca4ba3

Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no

More information about the grass-user mailing list