Load NHDplus layers into current session

nhd_plus_load(
  vpu,
  component = "NHDSnapshot",
  dsn,
  file_ext = NA,
  approve_all_dl = FALSE,
  force_dl = FALSE,
  temporary = FALSE,
  pretty = FALSE,
  wkt_filter = NA,
  ...
)

Arguments

vpu

numeric vector processing unit

component

character component name

dsn

data source name

file_ext

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

approve_all_dl

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

force_dl

logical force a re-download of the requested data

temporary

logical set FALSE to save data to a persistent rappdirs location

pretty

more minimal pretty printing st_read relative to "quiet"

wkt_filter

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

...

parameters passed on to sf::st_read

Value

spatial object

Details

This function will ask the user to approve downloading missing data unless approve_all_dl is set to TRUE. Output of this function is saved in active memory (memoized) to speed up repeated function calls.

Examples

if (FALSE) {
# Spatial
dt <- nhd_plus_load(4, "NHDSnapshot", "NHDWaterbody")
dt <- nhd_plus_load(c(1,2), "NHDSnapshot", "NHDWaterbody")
dt <- nhd_plus_load(4, "NHDSnapshot", "NHDFlowline")
dt <- nhd_plus_load(4, "NHDPlusCatchment", "Catchment")

# Quieter printing
dt <- nhd_plus_load(4, "NHDSnapshot", "NHDWaterbody", pretty = TRUE)
# Quietest printing
dt <- nhd_plus_load(4, "NHDSnapshot", "NHDWaterbody", quiet = TRUE)

# Non-spatial
dt <- nhd_plus_load(1, "NHDPlusAttributes", "PlusFlow")
dt <- nhd_plus_load("National", "V1_To_V2_Crosswalk",
 "NHDPlusV1Network_V2Network_Crosswalk")
gridcode      <- nhd_plus_load(1, "NHDPlusCatchment", "featuregridcode")
flowline_vaa  <- nhd_plus_load(1, "NHDPlusAttributes", "PlusFlowlineVAA")
eromflow      <- nhd_plus_load(4, "EROMExtension", "EROM_010001")

# Character VPU
plusflow <- nhd_plus_load(vpu = "10L", "NHDPlusAttributes", "PlusFlow")

# Spatial filtering via wkt_filter
dt <- nhd_plus_load(4, "NHDSnapshot", "NHDWaterbody", wkt_filter = "POINT (-85.411 42.399)")

}