leastcostpath (version 2.0.12)

create_FETE_lcps: Calculate Least-cost Paths from each location to all other locations

Description

Calculates Least-cost paths from-everywhere-to-everywhere. This is based on the approach proposed by White and Barber (2012).

Usage

create_FETE_lcps(x, locations, cost_distance = FALSE, ncores = 1)

Value

sf or spatVector Least-cost paths from-everywhere-to-everywhere based on the supplied conductanceMatrix. If supplied locations is a spatVector object then spatVector object returned else sf object

Arguments

x

conductanceMatrix

locations

sf 'POINT' or 'MULTIPOINT', SpatVector, data.frame or matrix containing the locations coordinates

cost_distance

logical if TRUE computes total accumulated cost from origin to destination. FALSE (default)

ncores

numeric Number of cores used when calculating least-cost paths from-everywhere-to-everywhere. 1 (default)

Author

Joseph Lewis

Examples

Run this code

r <- terra::rast(system.file("extdata/SICILY_1000m.tif", package="leastcostpath"))

slope_cs <- create_slope_cs(x = r, cost_function = "tobler", neighbours = 4)

locs <- sf::st_sf(geometry = sf::st_sfc(
sf::st_point(c(839769, 4199443)),
sf::st_point(c(1038608, 4100024)),
sf::st_point(c(907695, 4145478)),
sf::st_point(c(907695, 4145478)),
crs = terra::crs(r)))

lcps <- create_FETE_lcps(x = slope_cs, locations = locs)

Run the code above in your browser using DataLab