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

View source: R/create_FETE_lcps.R

create_FETE_lcpsR Documentation

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)

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)

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

Author(s)

Joseph Lewis

Examples


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)

leastcostpath documentation built on Oct. 10, 2023, 1:06 a.m.