% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/slopes.R
\name{route_to_segments}
\alias{route_to_segments}
\title{Split a route into vertex-to-vertex segments}
\usage{
route_to_segments(route_xyz)
}
\arguments{
\item{route_xyz}{An sf object with a single LINESTRING geometry with Z coordinates,
as returned by \code{\link[=elevation_add]{elevation_add()}}.}
}
\value{
An sf object with one LINESTRING feature per vertex-to-vertex segment.
}
\description{
Splits a linestring with XYZ coordinates into individual 2-point segments,
one per consecutive vertex pair. Useful for computing per-segment slopes
with \code{\link[=slope_xyz]{slope_xyz()}}.
}
\examples{
route_xyz = elevation_add(lisbon_route, dem = dem_lisbon())
segs = route_to_segments(route_xyz)
segs$slope = slope_xyz(segs)
summary(segs$slope)
}
