get_xs_points | R Documentation |
Uses a cross section retrieval web services to retrieve a cross section between two endpoints.
get_xs_points(point1, point2, num_pts, res = 1)
point1 |
sfc POINT including crs as created by:
|
point2 |
sfc POINT including crs. |
num_pts |
numeric number of points to retrieve along the cross section. |
res |
integer resolution of 3D Elevation Program data to request. Must be on of: 1, 3, 5, 10, 30, 60. |
sf data.frame containing points retrieved.
point1 <- sf::st_sfc(sf::st_point(x = c(-105.9667, 36.17602)), crs = 4326)
point2 <- sf::st_sfc(sf::st_point(x = c(-105.97768, 36.17526)), crs = 4326)
(xs <- get_xs_points(point1, point2, 100))
if(inherits(xs, "sf")) {
bbox <- sf::st_bbox(xs) + c(-0.005, -0.005, 0.005, 0.005)
nhdplusTools::plot_nhdplus(bbox = bbox, cache_data = FALSE)
plot(sf::st_transform(sf::st_geometry(xs), 3857), pch = ".", add = TRUE, col = "red")
plot(sf::st_transform(sf::st_sfc(point1, crs = 4326), 3857), add = TRUE)
plot(sf::st_transform(sf::st_sfc(point2, crs = 4326), 3857), add = TRUE)
plot(xs$distance_m, xs$elevation_m)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.