Calculates topographic position using mean deviations

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

Arguments

x

A raster class object

scale

focal window size (n-cell x n-cell for rectangle or distance for circle)

win

Window type. Options are "rectangle" and "circle"

normalize

Apply deviation correction that normalizes to local surface roughness

zero.correct

Apply correction for zero values in matrix weights

Value

raster class object of tpi metric

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.

Author

Jeffrey S. Evans <jeffrey_evans@tnc.org>

Examples

# \donttest{ library(raster) data(elev) # calculate tpi and plot tpi7 <- tpi(elev, scale=7) tpi025 <- tpi(elev, win = "circle", scale=0.025)
#> Error in tpi(elev, win = "circle", scale = 0.025): Scale is too small for a circular window
tpi025.zc <- tpi(elev, win = "circle", scale=0.025, zero.correct = TRUE)
#> Error in tpi(elev, win = "circle", scale = 0.025, zero.correct = TRUE): Scale is too small for a circular window
opar <- par(no.readonly=TRUE) par(mfrow=c(2,2)) plot(elev, main="original raster") plot(tpi7, main="tpi 7x7") plot(tpi025, main="tpi Circular window d=0.025")
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'plot': object 'tpi025' not found
plot(tpi025, main="tpi Circular window d=0.025, zero correct")
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'plot': object 'tpi025' not found
par(opar)
# }