| nhd_plus_query | R Documentation | 
Select NHDplus features via polygon or circular buffer of coordinate pair
nhd_plus_query(
  lon = NA,
  lat = NA,
  poly = NA,
  dsn,
  buffer_dist = units::as_units(4.75, "km"),
  approve_all_dl = FALSE,
  temporary = TRUE,
  ...
)
| lon | numeric longitude. optional | 
| lat | numeric latitude. optional | 
| poly | sfc polygon. optional | 
| dsn | character data source | 
| buffer_dist | numeric buffer in units of coordinate degrees | 
| approve_all_dl | logical blanket approval to download all missing data. Defaults to TRUE if session is non-interactive. | 
| temporary | logical set FALSE to save data to a persistent rappdirs location | 
| ... | parameters passed on to sf::st_read | 
A list of sf spatial objects
## Not run: 
library(sf)
wk <- wikilake::lake_wiki("Gull Lake (Michigan)")
pnt <- st_as_sf(wk, coords = c("Lon", "Lat"), crs = 4326)
pnt <- st_transform(pnt, st_crs(vpu_shp))
# nhd_plus_list(nhdR::find_vpu(pnt))
qry <- nhd_plus_query(wk$Lon, wk$Lat,
  dsn = c("NHDWaterbody", "NHDFlowLine"), buffer_dist = units::as_units(4.75, "km"))
plot(qry$sp$NHDWaterbody$geometry, col = "blue")
plot(qry$sp$NHDFlowLine$geometry, col = "cyan", add = TRUE)
plot(qry$pnt, col = "red", pch = 19, add = TRUE)
axis(1)
axis(2)
library(ggplot2)
ggplot(qry$sp$NHDWaterbody) + geom_sf()
# query with a polygon
wbd <- qry$sp$NHDWaterbody[which.max(st_area(qry$sp$NHDWaterbody)), ]
qry_lines <- nhd_plus_query(poly = st_as_sfc(st_bbox(wbd)),
  dsn = "NHDFlowLine")
ggplot() +
  geom_sf(data = qry$sp$NHDWaterbody) +
  geom_sf(data = qry_lines$sp$NHDFlowLine, color = "red")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.