% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/slopes.R
\name{elevation_add}
\alias{elevation_add}
\title{Add elevation data to route linestrings}
\usage{
elevation_add(routes, dem = NULL, method = "bilinear", terra = NULL)
}
\arguments{
\item{routes}{An sf object containing linestring geometries}

\item{dem}{A SpatRaster object containing elevation data (default: NULL for automatic download)}

\item{method}{Method for raster extraction (default: "bilinear")}

\item{terra}{Deprecated. Ignored; terra is always used.}
}
\value{
An sf object with XYZ linestring geometries
}
\description{
Adds elevation (Z) coordinates to linestring geometries using DEM data.
}
\examples{
library(sf)
routes = lisbon_road_network[204, ]
dem = dem_lisbon()
(r3d = elevation_add(routes, dem))
st_z_range(routes)
st_z_range(r3d)
plot(st_coordinates(r3d)[, 3])
plot_slope(r3d)
\dontrun{
# Get elevation data (requires internet connection, ceramic pkg, and API key):
if (requireNamespace("ceramic", quietly = TRUE)) {
  r3d_get = elevation_add(cyclestreets_route)
  plot_slope(r3d_get)
}
}
}
