create_banded_lcps: Calculate Least Cost Paths from random locations within...

View source: R/create_banded_lcps.R

create_banded_lcpsR Documentation

Calculate Least Cost Paths from random locations within distances

Description

Calculates Least Cost Paths from centre location to random locations within a specified distance band. This is based on the method proposed by Llobera (2015).

Usage

create_banded_lcps(
  cost_surface,
  location,
  min_distance,
  max_distance,
  radial_points,
  cost_distance = FALSE,
  parallel = FALSE,
  ncores = 1
)

Arguments

cost_surface

TransitionLayer (gdistance package). Cost surface to be used in Least Cost Path calculation

location

SpatialPoints* (sp package). Location from which the Least Cost Paths are calculated. If there are multiple SpatialPoints in the supplied data, only the first SpatialPoint is taken into account

min_distance

numeric value. minimum distance from centre location

max_distance

numeric value. maximum distance from centre location

radial_points

numeric value. Number of random locations around centre location within distances

cost_distance

logical. if TRUE computes total accumulated cost for each Least Cost Path. Default is FALSE

parallel

logical. if TRUE, the Least Cost Paths will be calculated in parallel. Default is FALSE

ncores

numeric. Number of cores used if parallel is TRUE. Default value is 1.

Value

SpatialLinesDataFrame (sp package). The resultant object contains least cost paths (number of LCPs is dependent on radial_points argument) calculated from a centre location to random locations within a specified distance band.

Author(s)

Joseph Lewis

References

Llobera, M. (2015). Working the digital: some thoughts from landscape archaeology. In Chapman R, Wylie A (eds), Material evidence: learning from archaeological practice (pp. 173-188). Abingdon: Routledge.

Examples


r <- raster::raster(nrow=50, ncol=50,  xmn=0, xmx=50, ymn=0, ymx=50, crs='+proj=utm')

r[] <- stats::runif(1:length(r))

slope_cs <- create_slope_cs(r, cost_function = 'tobler')

locs <- sp::spsample(as(raster::extent(r), 'SpatialPolygons'),n=1,'random')

lcp_network <- create_banded_lcps(cost_surface = slope_cs, location = locs, min_distance = 5,
max_distance = 25, radial_points = 10, cost_distance = FALSE, parallel = FALSE)


leastcostpath documentation built on June 3, 2022, 9:06 a.m.