makeTerrainVisTerra: makeTerrainVisTerra

View source: R/makeLSPs.R

makeTerrainVisTerraR Documentation

makeTerrainVisTerra

Description

Make three band terrain stack from input digital terrain model using terra

Usage

makeTerrainVisTerra(
  dtm,
  cellSize,
  innerRadius = 2,
  outerRadius = 10,
  hsRadius = 50,
  writeRaster = FALSE,
  outName
)

Arguments

dtm

Input SpatRaster object representing bare earth surface elevations.

cellSize

Resolution of the grid relative to coordinate reference system units (e.g., meters).

innerRadius

inner radius of annulus moving window used for local TPI calculation. Default is 2.

outerRadius

outer radius of annulus moving window used for local TPI calculation.

hsRadius

outer radisu for circular moving window used for hillslope TPI calculation.

writeRaster

TRUE or FALSE. Save output to disk. Default is TRUE.

outName

Name of output raster with full file path and extension.

Details

This function creates a three-band raster stack from an input digital terrain model (DTM) of bare earth surface elevations using terra. This implementation is slower than the torch-based implementation, especially when the torh-based implementation uses GPU-based computation.

The first band is a topographic position index (TPI) calculated using a moving window with a 50 m circular radius. The second band is the square root of slope calculated in degrees. The third band is a TPI calculated using an annulus moving window with an inner radius of 2 and outer radius of 5 meters. The TPI values are clamped to a range of -10 to 10 then linearly rescaled from 0 and 1. The square root of slope is clamped to a ange of 0 to 10 then linearly rescaled from 0 to 1. Values are provided in floating point.

The stack is described in the following publication and was originally proposed by William Odom of the United States Geological Survey (USGS):

Maxwell, A.E., W.E. Odom, C.M. Shobe, D.H. Doctor, M.S. Bester, and T. Ore, 2023. Exploring the influence of input feature space on CNN-based geomorphic feature extraction from digital terrain data, Earth and Space Science, 10: e2023EA002845. https://doi.org/10.1029/2023EA002845.

Value

Three-band raster grid written to disk in TIFF format and spatRaster object.

Examples

## Not run: 
pth <- "OUTPUT PATH"
dtm <- rast(paste0(pth, "dtm.tif"))
tVisT <- makeTerrainVisTerra(dtm,
cellSize=1,
innerRadius=2,
outerRadius=5,
hsRadius=50,
writeRaster=TRUE,
outName=paste0(pth, "tVisTerra.tif"))

## End(Not run)

geodl documentation built on Nov. 12, 2025, 5:07 p.m.