Skip to contents

This function downloads Watershed Boundary Dataset (WBD) HUC polygons for a given county in Washington and clips HUC polygon to the conservation district provided. Optionally saves the results as a shapefile. Clipped acres of each watershed are automatically recalculated and added as Acres_in_huc variable

Usage

get_huc_by_cd(
  district_name,
  huc_level = "huc12",
  save_shp = FALSE,
  shp_path = NULL
)

Arguments

district_name

Character. Name of the district (e.g., "Columbia").

huc_level

Character. One of "huc02" "huc04" "huc06" "huc08" "huc10" "huc12" "huc12_nhdplusv2"

save_shp

Logical. Whether to save the result as a shapefile. Default is FALSE.

shp_path

Character. File path to save shapefile (without extension). Default is NULL.

Value

An sf object with watershed polygons assigned to the input county.

Examples

if (FALSE) { # \dontrun{

 asotin_huc12s <- get_huc_by_cd("Asotin",
 huc_level = "huc12")

  leaflet() %>%
  addTiles() %>%
  addPolygons(data=asotin_huc12s,label=~name)

 get_huc_by_cd("Asotin",
 huc_level = "huc12",
 save_shp = TRUE,
 shp_path = "../../../Documents/asotin_huc12_clipped")

} # }