Convert USGS Hydrologic Unit Shapefiles

Share:

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

1
2
convertWBDHUC(dsnPath = NULL, level = 8, extension = "",
  nameOnly = 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 extsion associated with mapshaper simplified files

nameOnly

logical specifying whether to only return the name without creating the file

Details

The full WBD dataset can be downloaded from the USGS with the following command:

1
curl ftp://rockyftp.cr.usgs.gov/vdelivery/Datasets/Staged/WBD/Shape/WBD_National.zip -O

Typically, the raw data will be simplified using the command line version of mapshpaper. (Installation instructions are found at this URL.)

With mapshaper, you can reduce the number of vertices in the polygons, greatlyl improving the efficiency of spatial searches. Experimentation at the mapshaper website show 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:

1
mapshaper WBDHU2.shp --simplify 1

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

Value

Name of the dataset being created.

References

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

See Also

setSpatialDataDir

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.