Get NHDPlus HiRes
get_nhdplushr(
hr_dir,
out_gpkg = NULL,
layers = c("NHDFlowline", "NHDPlusCatchment"),
pattern = ".*GDB.gdb$",
check_terminals = TRUE,
overwrite = FALSE,
keep_cols = NULL,
...
)
character directory with geodatabases (gdb search is recursive)
character path to write output geopackage
character vector with desired layers to return. c("NHDFlowline", "NHDPlusCatchment") is default. Choose from: c("NHDFlowline", "NHDPlusCatchment", "NHDWaterbody", "NHDArea", "NHDLine", "NHDPlusSink", "NHDPlusWall", "NHDPoint", "NHDPlusBurnWaterbody", "NHDPlusBurnLineEvent", "HYDRO_NET_Junctions", "WBDHU2", "WBDHU4","WBDHU6", "WBDHU8" "WBDHU10", "WBDHU12", "WBDLine") Set to NULL to get all available.
character optional regex to select certain files in hr_dir
boolean if TRUE, run make_standalone on output.
boolean should the output overwrite? If false and the output layer exists, it will be read and returned so this function will always return data even if called a second time for the same output. This is useful for workflows. Note that this will NOT delete the entire Geopackage. It will overwrite on a per layer basis.
character vector of column names to keep in the output. If NULL, all will be kept.
parameters passed along to get_hr_data for "NHDFlowline" layers.
sf data.frames containing output that may also be written to a geopackage for later use.
NHDFlowline is joined to value added attributes prior to being returned. Names are not modified from the NHDPlusHR geodatabase. Set layers to "NULL" to get all layers.
if (FALSE) { # \dontrun{
# Note this will download a lot of data to a temp directory.
# Change 'temp_dir' to your directory of choice.
temp_dir <- file.path(nhdplusTools_data_dir(), "temp_hr_cache")
download_dir <- download_nhdplushr(temp_dir, c("0302", "0303"))
get_nhdplushr(download_dir, file.path(download_dir, "nhdplus_0302-03.gpkg"))
get_nhdplushr(download_dir,
file.path(download_dir, "nhdplus_0302-03.gpkg"),
layers = NULL, overwrite = TRUE)
get_nhdplushr(download_dir,
file.path(download_dir, "nhdplus_0302-03.gpkg"),
layers = "NHDFlowline", overwrite = TRUE,
min_size_sqkm = 10, simp = 10, proj = "+init=epsg:5070")
# Cleanup
unlink(temp_dir, recursive = TRUE)
} # }