hf_barrier: Obstacle to travel

View source: R/hf_barrier.R

hf_barrierR Documentation

Obstacle to travel

Description

Prevents travel along paths that cross through barriers or other obstacles that cannot be traversed, like a river, a Greek phalanx, or "the Wall".

Usage

hf_barrier(x, barrier)

Arguments

x

a cost terrain generated by hf_terrain().

barrier

an sf object.

Value

a terrain representing cost of travel.

Examples

library(sf)
library(terra)

fn <- system.file("extdata/red_butte_dem.tif", package = "hiker")
red_butte_dem <- rast(fn)

fn <- system.file("extdata/red_butte_reservoir.geojson", package = "hiker")
red_butte_reservoir <- read_sf(fn)

terrain <- hf_terrain(red_butte_dem)

terrain <- hf_barrier(terrain, red_butte_reservoir)

plot(terrain, main = "Travel Cost")
plot(st_geometry(red_butte_reservoir),
     col = NA,
     border = "red2",
     add = TRUE)


kbvernon/hiker documentation built on Dec. 9, 2022, 11:16 p.m.