Select NHD features clipped by a circular buffer a coordinate pair
nhd_query( lon = NA, lat = NA, poly = NA, dsn, approve_all_dl = FALSE, buffer_dist = units::as_units(4.75, "km"), temporary = TRUE, ... )
lon: numeric longitudelat: numeric latitudepoly: sfc polygon. optionaldsn: character data sourceapprove_all_dl: logical blanket approval to download all missing data. Defaults to TRUE if session is non-interactive.buffer_dist: numeric buffer with specified unitstemporary: logical set FALSE to save data to a persistent rappdirs location...: other arguments passed to sf::st_read## Not run: library(sf) wk <- wikilake::lake_wiki("Worden Pond") qry <- nhd_query(wk$Lon, wk$Lat, dsn = c("NHDWaterbody", "NHDFlowLine"), buffer_dist = units::as_units(1, "km")) qry$sp$NHDWaterbody <- dplyr::filter(qry$sp$NHDWaterbody, FType != 466) plot(sf::st_geometry(qry$sp$NHDWaterbody), col = "blue") plot(sf::st_geometry(qry$sp$NHDFlowLine), col = "cyan", add = TRUE) plot(qry$pnt, col = "red", pch = 19, add = TRUE) axis(1) axis(2) # query with a polygon wbd <- qry$sp$NHDWaterbody[ order(st_area(qry$sp$NHDWaterbody), decreasing = TRUE), ][1, ] qry_lines <- nhd_query(poly = st_as_sfc(st_bbox(wbd)), dsn = "NHDFlowLine") library(ggplot2) ggplot() + geom_sf(data = qry$sp$NHDWaterbody) + geom_sf(data = qry_lines$sp$NHDFlowLine, color = "red") ## End(Not run)
Related functions from the same R package