nhdR (version 0.5.3)

leaf_reaches: Return leaf reaches from a network or query intersecting lake

Description

A leaf reach is a stream flowline that has upstream connections but is not in the focal set.

Usage

leaf_reaches(lon = NA, lat = NA, network = NA, approve_all_dl = FALSE, ...)

Arguments

lon

numeric decimal degree longitude. optional. See Details section.

lat

numeric decimal degree latitude. optional. See Details section.

network

sf lines collection. optional. See Details section.

approve_all_dl

logical blanket approval to download all missing data. Defaults to TRUE if session is non-interactive.

...

parameters passed on to sf::st_read

Examples

Run this code
# NOT RUN {
coords <- data.frame(lat = 20.79722, lon = -156.47833)
leaf_reaches(coords$lon, coords$lat)

coords  <- data.frame(lat = 41.42217, lon = -73.24189)
l_reach <- leaf_reaches(coords$lon, coords$lat)

network <- nhd_plus_query(lon = coords$lon, lat = coords$lat,
                          dsn = "NHDFlowline", buffer_dist = 0.02)$sp$NHDFlowline
l_reach <- leaf_reaches(network = network)

plot(network$geometry)
plot(l_reach$geometry, col = "red", add = TRUE)
# }

Run the code above in your browser using DataCamp Workspace