MazamaSpatialUtils (version 0.6.4)

convertWBDHUC: Convert USGS hydrologic unit shapefiles

Description

Previously downloaded shapefiles from the USGS Watershed Boundary Dataset are converted to a SpatialPolygonsDataFrame with additional columns of data. The resulting file will be created in the spatial data directory which is set with setSpatialDataDir().

Usage

convertWBDHUC(dsnPath = NULL, level = 8, extension = "",
  nameOnly = FALSE, simplify = FALSE)

Arguments

dsnPath

directory where the WBD HUC datasets are found

level

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

extension

Character extension associated with mapshaper simplified files.

nameOnly

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

simplify

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

Value

Name of the dataset being created.

Details

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

Typically, the raw data will be simplified using mapshaper.

With mapshaper, you can reduce the number of vertices in the polygons, greatly improving the efficiency of spatial searches. Experimentation shows that a reduction to 1-2 of the original shapefile size still retains the recognizable shape of polygons, removing only the higher order "crenellations" in the polygons.

An example use of mapshaper would be:

mapshaper WBDHU2.shp --simplify 1

A full suite of .shp, .shx, .dbf, .prj files will be created for the new name WBDHU2_02.

References

http://nhd.usgs.gov/wbd.html

See Also

setSpatialDataDir