Skip to contents

Which fish species are found where? Download and clip by County.Data provided by WA Dept of Fish and Wildlife

Usage

get_swifd_by_county(county_names, save_path = NULL)

Arguments

county_names

Character vector. One or more county names (e.g., "Columbia", "Walla Walla").

save_path

Optional character. Directory where the output Shapefile should be saved. A merged Shapefile will be saved to swifd_<joined_counties>.shp inside this directory.

Value

An sf object of SWIFD features clipped to the specified counties.

Details

This function:

  • Uses {tigris} to get Washington county boundaries.

  • Downloads the full SWIFD dataset in GeoJSON format via {httr}.

  • Parses the JSON using {geojsonsf}.

  • Clips to the union of the selected counties, applying a small buffer to capture stream overlaps.

  • Optionally writes the result to disk as a Shapefile.

Examples

if (FALSE) { # \dontrun{

swifd_multi <- get_swifd_by_county(c("Columbia", "Garfield"))

get_swifd_by_county(c("Columbia", "Garfield"), save_path = "data/southwest_swifd")
} # }