create_lcp | R Documentation |
Calculates the Least-cost path from an origin location to one or more destination locations. Applies Dijkstra's algorithm as implemented in the igraph R package.
create_lcp(
x,
origin,
destination,
cost_distance = FALSE,
check_locations = FALSE
)
x |
|
origin |
|
destination |
|
cost_distance |
|
check_locations |
|
sf
Least-cost path from origin and destinations based on the supplied conductanceMatrix
Joseph Lewis
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(1017819, 4206255)),
sf::st_point(c(1017819, 4206255)),
crs = terra::crs(r)))
lcps <- create_lcp(x = slope_cs, origin = locs[1,], destination = locs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.