Learn R Programming

MazamaSpatialUtils (version 0.7.6)

convertWBDHUC: Convert USGS hydrologic unit shapefiles

Description

Create a SpatialPolygonsDataFrame for USGS watershed boundaries

Usage

convertWBDHUC(
  gdbDir = "~/Data/WBD/WBD_National_GDB.gdb",
  level = 2,
  nameOnly = FALSE,
  simplify = TRUE,
  cleanTopology = FALSE
)

Value

Name of the dataset being created.

Arguments

gdbDir

Directory containing the geodatabase.

level

Character or integer which must be 2, 4, 6, 8, 10, 12 or 14.

nameOnly

Logical specifying whether to only return the name without creating the file.

simplify

Logical specifying whether to create "_05", _02" and "_01" versions of the file that are simplified to 5%, 2% and 1%.

cleanTopology

Logical specifying to use the cleangeo package to clean topological errors in the shapefiles.

Details

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

References

https://www.usgs.gov/core-science-systems/ngp/national-hydrography/watershed-boundary-dataset

See Also

setSpatialDataDir