uses the Network Linked Data Index to retrieve an estimated network location for the given point. If not within a grid cell of a flowline, will use a raindrop trace service to find the nearest downslope flowline location.
get_nldi_index(location)sf data.frame of estimated network locations for the given point. NULL if the NLDI service is unavailable.
# \donttest{
index <- get_nldi_index(c(-89.276, 42.988))
#> GET https://api.water.usgs.gov/nldi/linked-data/hydrolocation?coords=POINT(-89.276%2042.988)
if(inherits(index, "sf")) {
plot_nhdplus(
bbox = sf::st_bbox(
sf::st_buffer(
sf::st_transform(index[1,], 5070), units::set_units(1000, "m")
)
)
)
plot(sf::st_geometry(sf::st_transform(index, 3857)), add = TRUE)
}
#> GET https://api.water.usgs.gov/fabric/pygeoapi/collections/nhdflowline_network/items?bbox=-89.292922,42.974534,-89.266582,42.993658&limit=500&offset=0
# }