Download NHD
download_nhd(nhd_dir, hu_list, download_files = TRUE)
character directory to save output into
character vector of hydrologic region(s) to download. Use get_huc to find HU codes of interest. Accepts two digit and four digit codes.
boolean if FALSE, only URLs to files will be returned can be hu02s and/or hu04s
character Paths to geodatabases created.
# \donttest{
hu <- get_huc(sf::st_sfc(sf::st_point(c(-73, 42)), crs = 4326),
type = "huc08")
#> Spherical geometry (s2) switched off
#> although coordinates are longitude/latitude, st_intersects assumes that they
#> are planar
#> Spherical geometry (s2) switched on
(hu <- substr(hu$huc8, 1, 2))
#> [1] "01"
download_nhd(tempdir(), c(hu, "0203"), download_files = FALSE)
#> [1] "https://prd-tnm.s3.amazonaws.com/StagedProducts/Hydrography/NHD/HU4/GDB/NHD_H_0101_HU4_GDB.zip"
#> [2] "https://prd-tnm.s3.amazonaws.com/StagedProducts/Hydrography/NHD/HU4/GDB/NHD_H_0102_HU4_GDB.zip"
#> [3] "https://prd-tnm.s3.amazonaws.com/StagedProducts/Hydrography/NHD/HU4/GDB/NHD_H_0103_HU4_GDB.zip"
#> [4] "https://prd-tnm.s3.amazonaws.com/StagedProducts/Hydrography/NHD/HU4/GDB/NHD_H_0104_HU4_GDB.zip"
#> [5] "https://prd-tnm.s3.amazonaws.com/StagedProducts/Hydrography/NHD/HU4/GDB/NHD_H_0105_HU4_GDB.zip"
#> [6] "https://prd-tnm.s3.amazonaws.com/StagedProducts/Hydrography/NHD/HU4/GDB/NHD_H_0106_HU4_GDB.zip"
#> [7] "https://prd-tnm.s3.amazonaws.com/StagedProducts/Hydrography/NHD/HU4/GDB/NHD_H_0107_HU4_GDB.zip"
#> [8] "https://prd-tnm.s3.amazonaws.com/StagedProducts/Hydrography/NHD/HU4/GDB/NHD_H_0108_HU4_GDB.zip"
#> [9] "https://prd-tnm.s3.amazonaws.com/StagedProducts/Hydrography/NHD/HU4/GDB/NHD_H_0109_HU4_GDB.zip"
#> [10] "https://prd-tnm.s3.amazonaws.com/StagedProducts/Hydrography/NHD/HU4/GDB/NHD_H_0110_HU4_GDB.zip"
#> [11] "https://prd-tnm.s3.amazonaws.com/StagedProducts/Hydrography/NHD/HU4/GDB/NHD_H_0203_HU4_GDB.zip"
# }