leastcostpath (version 2.0.12)

create_cost_corridor: creates a cost corridor

Description

Combines and averages the accumulated cost surfaces from origin-to-destination and destination-to-origin to identify areas of preferential movement that takes into account both directions of movement

Usage

create_cost_corridor(x, origin, destination, rescale = FALSE)

Value

SpatRaster

Arguments

x

SpatRaster

origin

sf 'POINT' or 'MULTIPOINT', SpatVector, data.frame or matrix containing the origin coordinates. Only the first row of the supplied object is used as the origin.

destination

sf 'POINT' or 'MULTIPOINT', SpatVector, data.frame or matrix containing the destination coordinates. Only the first row of the supplied object is used as the destination.

rescale

logical. if TRUE, values scaled to between 0 and 1. FALSE (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)),
crs = terra::crs(r)))

cc <- create_cost_corridor(x = slope_cs, origin = locs[1,], destination = locs[2,], rescale = TRUE)

Run the code above in your browser using DataLab