en_lcp {enerscape} | R Documentation |
Calculate the least-cost path (lcp) between origin and destination
en_lcp(en, or, dest, simulate_random_points = FALSE, rep = 10, plot = TRUE)
en |
an enerscape object obtained with |
or |
origin point. |
dest |
destination point. |
simulate_random_points |
if to simulate least-cost path among random points. default = FALSE. |
rep |
number or random origin and destination points if
|
plot |
if to plot the output. |
If or
and dest
are not specified, the least-cost path
is specified by setting simulate_random_points = TRUE
and rep
equal to the number of random paths to compute.
A list with point locations, least-cost path as SpatialLines, energy costs and distances.
library(raster)
data("volcano")
dem <- raster(volcano)
en <- enerscape(dem, 10, unit = "kcal", neigh = 16)
p <- xyFromCell(dem, sample(ncell(dem), 2))
lcp <- en_lcp(en, or = p[1, ], dest = p[2, ])