Calculates slope gradients for routes using digital elevation model (DEM) raster data.
Usage
slope_raster(
  routes,
  dem,
  lonlat = sf::st_is_longlat(routes),
  method = "bilinear",
  fun = slope_matrix_weighted,
  terra = has_terra() && methods::is(dem, "SpatRaster"),
  directed = FALSE
)Arguments
- routes
- An sf object containing linestring geometries 
- dem
- A raster object containing elevation data 
- lonlat
- Logical, whether coordinates are longitude/latitude (default: auto-detected) 
- method
- Method for raster extraction (default: "bilinear") 
- fun
- Function for slope calculation (default: slope_matrix_weighted) 
- terra
- Logical, whether to use terra package (default: auto-detected) 
- directed
- Logical, whether to calculate directed slopes (default: FALSE) 
