Skip to contents

This function intersects HUC12 watersheds with Water Resource Inventory Areas (WRIAs) and assigns each HUC12 to the WRIA that overlaps it the most by area. Both input layers are transformed to EPSG:5070 (NAD83 / Conus Albers) for accurate area calculation.

Usage

assign_wria_to_huc12(
  huc12_sf,
  wria_sf,
  huc_id_col = "huc12",
  huc_name_col = "name"
)

Arguments

huc12_sf

An sf object of HUC12 polygons. Must include numeric column for HUC12 values.

wria_sf

An sf object of WRIA polygons.

huc_id_col

Character name of the HUC12 ID column (e.g., "huc12").

huc_name_col

Character name of the HUC12 watershed

Value

A data.frame

Examples

if (FALSE) { # \dontrun{
huc12_wria_table <- assign_wria_to_huc12(
  huc12_sf = huc12_layer,
  wria_sf = wria_layer,
  huc_id_col = "huc12",
  huc_name_col = "name"
)

# Join to spatial layer
huc12_with_wria <- dplyr::left_join(huc12_layer, huc12_wria_table, by = "HUC12")
} # }