create_cost_corridor: creates a cost corridor

View source: R/create_cost_corridor.R

create_cost_corridorR Documentation

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)

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)

Value

SpatRaster

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)),
crs = terra::crs(r)))

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

josephlewis/leastcostpath documentation built on Oct. 18, 2023, 2:03 p.m.