(This article was first published on

Terrain attributes can be derived by elevation values on a small neighbourhood of each DEM point.**R Video tutorial for Spatial Statistics**, and kindly contributed to R-bloggers)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

To

**leave a comment**for the author, please follow the link and comment on his blog:**R Video tutorial for Spatial Statistics**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...