hf_appraise | R Documentation |
Estimate the cost of traveling the "shortest" or least-cost path between multiple start and end points. For each from-point, the cost of traveling the shortest path to every to-point is calculated.
hf_appraise(x, from, to)
x |
a cost |
from |
an |
to |
an |
a data.frame
with three columns: from, to, and cost. Values
in the from- and to-columns are 1:nrow(from)
and 1:nrow(to)
, respectively.
library(sf) library(terra) fn <- system.file("extdata/red_butte_dem.tif", package = "hiker") red_butte_dem <- rast(fn) from <- st_sf(geometry = st_sfc(st_point(c(432000, 4514000)), crs = 26912)) to <- st_sf(geometry = st_sfc(st_point(c(431000, 4515000)), st_point(c(436500, 4518500)), crs = 26912)) terrain <- hf_terrain(red_butte_dem) hf_appraise(terrain, from, to)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.