Learn R Programming

FedData (version 2.4.0)

get_nhd: Download and crop the National Hydrography Dataset.

Description

get_nhd returns a list of Spatial* objects extracted from the National Hydrography Dataset.

Usage

get_nhd(template, label, raw.dir = "./RAW/NHD/", extraction.dir = paste0("./EXTRACTIONS/", label, "/NHD/"), force.redo = FALSE)

Arguments

template
A Raster* or Spatial* object to serve as a template for cropping.
label
A character string naming the study area.
raw.dir
A character string indicating where raw downloaded files should be put. The directory will be created if missing. Defaults to './RAW/NHD/'.
extraction.dir
A character string indicating where the extracted and cropped NHD shapefiles should be put. The directory will be created if missing. Defaults to './EXTRACTIONS/NHD/'.
force.redo
If an extraction for this template and label already exists, should a new one be created?

Value

A list of Spatial* objects extracted from the National Hydrography Dataset.

Examples

Run this code
## Not run: 
# # Extract data for the Village Ecodynamics Project 'VEPIIN' study area:
# # http://village.anth.wsu.edu
# vepPolygon <- polygon_from_extent(raster::extent(672800,740000,4102000,4170000), 
#      proj4string='+proj=utm +datum=NAD83 +zone=12')
# 
# # Get the NHD (USA ONLY)
# NHD <- get_nhd(template=vepPolygon, label='VEPIIN')
# 
# # Plot the VEP polygon
# plot(vepPolygon)
# 
# # Plot the NHD data
# plot(NHD$NHDFlowline, add=T)
# plot(NHD$NHDLine, add=T)
# plot(NHD$NHDArea, col='black', add=T)
# plot(NHD$NHDWaterbody, col='black', add=T)
# ## End(Not run)

Run the code above in your browser using DataLab