en_lcp {enerscape}R Documentation

Compute least-cost paths

Description

Calculate the least-cost path (lcp) between origin and destination

Usage

en_lcp(en, or, dest, simulate_random_points = FALSE, rep = 10, plot = TRUE)

Arguments

en

an enerscape object obtained with enerscape().

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 simulate_random_points = TRUE. default = 10.

plot

if to plot the output.

Details

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.

Value

A list with point locations, least-cost path as SpatialLines, energy costs and distances.

Examples

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, ])

[Package enerscape version 0.1.3 Index]