A leaf reach is a stream flowline that has upstream connections but is not in the focal set.
leaf_reaches(
lon = NA,
lat = NA,
network = NA,
approve_all_dl = FALSE,
temporary = TRUE,
...
)
numeric decimal degree longitude. optional. See Details section.
numeric decimal degree latitude. optional. See Details section.
sf lines collection. optional. See Details section.
logical blanket approval to download all missing data. Defaults to TRUE if session is non-interactive.
logical set FALSE to save data to a persistent rappdirs location
parameters passed on to sf::st_read
An sf data frame with LINESTRING geometries
if (FALSE) {
coords <- data.frame(lat = 20.79722, lon = -156.47833)
# nhd_plus_get(
# nhdR::find_vpu(
# sf::st_as_sf(coords, coords = c("lon", "lat"), crs = 4326)),
# temporary = FALSE)
leaf_reaches(coords$lon, coords$lat)
coords <- data.frame(lat = 41.42217, lon = -73.24189)
l_reach <- leaf_reaches(coords$lon, coords$lat)
network_focal <- nhd_plus_query(lon = coords$lon, lat = coords$lat,
dsn = "NHDFlowline", buffer_dist = units::as_units(2, "km"))$sp$NHDFlowline
network <- nhd_plus_query(lon = coords$lon, lat = coords$lat,
dsn = "NHDFlowline", buffer_dist = units::as_units(5, "km"))$sp$NHDFlowline
l_reach <- leaf_reaches(network = network_focal)
plot(network$geometry)
plot(network_focal$geometry, col = "darkgreen", add=TRUE)
plot(l_reach$geometry, col = "red", add = TRUE)
}