Create a SpatialPolygonsDataFrame for USGS watershed boundaries
convertWBDHUC(
gdbDir = "~/Data/WBD/WBD_National_GDB.gdb",
level = 2,
nameOnly = FALSE,
simplify = TRUE,
cleanTopology = FALSE
)
Name of the dataset being created.
Directory containing the geodatabase.
Character or integer which must be 2, 4, 6, 8, 10, 12 or 14.
Logical specifying whether to only return the name without creating the file.
Logical specifying whether to create "_05", _02" and "_01" versions of the file that are simplified to 5%, 2% and 1%.
Logical specifying to use the cleangeo package to clean topological errors in the shapefiles.
A USGS Watershed Boundary Dataset geodatabase is converted to a
SpatialPolygonsDataFrame with additional columns of data. To use this
function, the WBD geodatabase must be downloaded into a directory which is
identified with gdbDir
. The resulting file will be created in the
spatial data directory which is set with setSpatialDataDir()
.
The full WBD dataset can be downloaded from the USGS with the following command:
curl https://prd-tnm.s3.amazonaws.com/StagedProducts/Hydrography/WBD/National/GDB/WBD_National_GDB.zip -O
https://www.usgs.gov/core-science-systems/ngp/national-hydrography/watershed-boundary-dataset
setSpatialDataDir