hf_channel: Channel of reduced cost

View source: R/hf_channel.R

hf_channelR Documentation

Channel of reduced cost

Description

Reduces cost of travel along paths that cross through channels or other aspects of a terrain that expedite travel. Examples include hiking trails, sidewalks, and Einstein-Rosen bridges (otherwise known as stargates).

Usage

hf_channel(x, channel, .m = 1)

Arguments

x

a cost terrain generated by hf_terrain().

channel

an sf object.

.m

a numeric between 0 and 1 applied as a weight to the cost of travel.

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_road.geojson", package = "hiker")
red_butte_road <- read_sf(fn)

terrain <- hf_terrain(red_butte_dem, hf = "tobler")

terrain <- hf_channel(terrain,
                      channel = red_butte_road,
                      .m = 0.6)

plot(terrain, main = "Travel Cost")
plot(st_geometry(red_butte_road),
     col = "red2",
     add = TRUE)


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