Learn R Programming

leastcostpath (version 1.7.4)

create_banded_lcps: 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
)

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. Only the first cell 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. Number of Parallel socket clusters is total number of cores available minus 1. Default is FALSE

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.

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

Run this code
# NOT RUN {
#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 = final_cost_cs, location = locs, min_distance = 20,
#max_distance = 50, radial_points = 10, cost_distance = FALSE, parallel = FALSE)

# }

Run the code above in your browser using DataLab