leastcostpath (version 1.2.1)

create_FETE_lcps: create_FETE_lcps

Description

Calculates least cost paths from each location to all other locations.

Usage

create_FETE_lcps(cost_surface, locations, cost_distance = FALSE,
  parallel = FALSE)

Arguments

cost_surface

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

locations

SpatialPoints. Locations to calculate Least Cost Paths from and to.

cost_distance

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

parallel

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 calculated from each location to all other locations.

Details

Computes least cost paths from each location to all other locations (i.e. From Everywhere To Everywhere (FETE)). This is based on the method proposed by White and Barber (2012).

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(r, 'SpatialPolygons'),n=5,'regular')

lcp_network <- create_FETE_lcps(cost_surface = slope_cs, locations = locs,
cost_distance = FALSE, parallel = FALSE)
# }

Run the code above in your browser using DataLab