elevation_add | R Documentation |
Take a linestring and add a third (z) dimension to its coordinates
elevation_add(
routes,
dem = NULL,
method = "bilinear",
terra = has_terra() && methods::is(dem, "SpatRaster")
)
routes |
Routes, the gradients of which are to be calculated.
The object must be of class |
dem |
Raster overlapping with |
method |
The method of estimating elevation at points,
passed to the |
terra |
Should the |
An sf object that is identical to the input routes
, except that
the coordinate values in the ouput has a third z
dimension representing
the elevation of each vertex that defines a linear feature such as a road.
library(sf)
routes = lisbon_road_network[204, ]
dem = dem_lisbon_raster
(r3d = elevation_add(routes, dem))
library(sf)
st_z_range(routes)
st_z_range(r3d)
plot(st_coordinates(r3d)[, 3])
plot_slope(r3d)
# Get elevation data (requires internet connection and API key):
r3d_get = elevation_add(cyclestreets_route)
plot_slope(r3d_get)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.