Learn R Programming

spatialEco (version 0.1-5)

tpi: Topographic Position Index (tpi)

Description

Calculates topographic position using mean deviations

Usage

tpi(x, scale = 3, win = "rectangle", normalize = FALSE)

Arguments

x
raster class object
scale
scale (window size)
win
window type. Options are "rectangle" and "circle"
normalize
Apply deviation correction that normalizes to local surface roughness

Value

raster class object of tpi

References

De Reu, J., J. Bourgeois, M. Bats, A. Zwertvaegher, V. Gelorini, et al., (2014) Application of the topographic position index to heterogeneous landscapes. Geomorphology, 186:39-49.

Examples

Run this code
 library(raster)
 r <- raster(nrows=500, ncols=500, xmn=571823, xmx=616763, 
             ymn=4423540, ymx=4453690)
 proj4string(r) <- crs("+proj=utm +zone=12 +datum=NAD83 +units=m +no_defs")
 r[] <- runif(ncell(r), 1000, 2500)
 r <- focal(r, focalWeight(r, 150, "Gauss") )

# calculate tpi and plot 
  tpi9 <- tpi(r, scale=9)     
    par(mfrow=c(1,2))
      plot(r, main="original raster")
      plot(tpi9, main="tpi 9x9")

Run the code above in your browser using DataLab