get_xs_points {nhdplusTools}R Documentation

Get Cross Section Endpoints (experimental)

Description

Uses a cross section retrieval web services to retrieve a cross section between two endpoints.

Usage

get_xs_points(point1, point2, num_pts, res = 1)

Arguments

point1

sfc POINT including crs as created by: sf::st_sfc(sf::st_point(.. ,..), crs)

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.

Value

sf data.frame containing points retrieved.

Examples


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)
}



[Package nhdplusTools version 1.2.1 Index]