nhd_load: Load NHD layers into current session

View source: R/load.R

nhd_loadR Documentation

Load NHD layers into current session

Description

Load NHD layers into current session

Usage

nhd_load(
  state,
  dsn,
  file_ext = NA,
  approve_all_dl = FALSE,
  temporary = FALSE,
  wkt_filter = NA,
  ...
)

Arguments

state

character state abbreviation

dsn

character name of a NHD layer

file_ext

character choice of "shp" for spatial data and "dbf" or "gpkg" for non-spatial. optional

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

wkt_filter

character. WKT spatial filter for selection. See sf::st_read

...

arguments passed to sf::st_read

Details

This function will ask the user to approve downloading missing data unless approve_all_dl is set to TRUE.

Value

Spatial simple features object or data frame depending on the dsn type and value passed to file_ext

Examples

## Not run: 
dt <- nhd_load(c("RI"), c("NHDWaterbody"))
dt <- nhd_load(c("CT", "RI"), "NHDWaterbody")
dt <- nhd_load(c("CT", "RI"), "NHDWaterbody", quiet = TRUE)
dt <- nhd_load("MI", "NHDFlowline")
dt <- nhd_load("RI", "NHDReachCrossReference")
dt <- nhd_load("RI", "NHDWaterbody", file_ext = "dbf")
dt <- nhd_load(c("RI", "DC"), "NHDWaterbody", file_ext = "gpkg")

dt <- nhd_load("RI", "NHDWaterbody", wkt_filter = "POINT (-71.575 41.438)")

dt <- nhd_load("RI", "NHDFlowline", pretty = FALSE, quiet = TRUE,
  query = paste0("SELECT * from ", "NHDFlowline", " LIMIT 1"))

## End(Not run)

nhdR documentation built on Aug. 12, 2023, 9:06 a.m.