Skip to contents

Given a sf object with 'XYZ' coordinates, return a vector of numeric values representing the average slope of each linestring in the sf data frame input.

The default calculates the slope using `slope_weighted()`. You can also use `slope_mean()` or any other function that takes the same inputs as these functions.

Usage

compute_channel_slope(path, fun = slope_weighted, directed = FALSE)

Arguments

path

an XYZ LINESTRING representing the path of travel

fun

The slope function to calculate per element, `slope_weighted` is the default.

directed

Should the value be directed? `FALSE` by default. If `TRUE` the result will be negative when it represents a downslope (when the end point is lower than the start point).

Value

A vector of slopes associated with each linear element The value is a proportion representing the change in elevation for a given change in horizontal distance.