The major attributes can be calculated from the derivatives of the topographic surface. These derivatives measure the rate of change in elevation in relation with the point location.

In literature are available several methods to compute these derivatives.

In this function the following methods have been implemented:

Evans (1980) - In this method a quadratic surface is fitted on a 3x3 elevation window and the derivatives are calculated using all the 9 cells in the windows.

Zevenbergen and Thorne (1987) - Here a more complex Lagrange polynomial is fitted to the topographic surface.

Moore et al. (1993) and Shary (1995), which are similar to the previous two. For more info refer to Florinsky (1998).

This function works with the package

**raster**.

It takes 3 arguments:

data: the

**raster**object

attr: the terrain attribute to be computed. At the moment the choice is between: "slope", "aspect", "plan.curvature" and "prof.curvature".

method: one of the four method implemented: The choice is between: "evans", "zev.tho", "moore" and "shary".

Ex.

DTM<-raster("c:/raster.asc")

slope<-DEMderiv(DTM,"slope","evans")

The output is a

**raster**object.

This is the code:

DEMderiv Function

This method does not work since the raster packages has been updated. In the latest version, the function focal does not produce a list of the raster values in any given moving window, but a list of weights that sum up to 1. For this reason a call to the function presented here will not provide the results expected.

ReplyDeleteIf someone is willing to try and fix it is encouraged to do so.