Calculate fetch (open water distance) and wave exposure metrics for lake sampling sites.
lakefetch calculates directional fetch using a ray-casting algorithm, can download lake boundaries from OpenStreetMap, and provides exposure classification for ecological and limnological studies. Unlike marine-focused packages (fetchR, waver), lakefetch is designed specifically for freshwater lakes with features like multi-lake batch processing and NHD integration.
Install the development version from GitHub:
# install.packages("devtools")
devtools::install_github("jeremylfarrell/lakefetch")library(lakefetch)
# Load your sampling sites (CSV with latitude/longitude columns)
sites <- load_sites("my_sites.csv")
# Download lake boundaries from OpenStreetMap
lake <- get_lake_boundary(sites)
# Calculate fetch for all sites
results <- fetch_calculate(sites, lake)
# View results
results$results # sf object with fetch data and exposure categorieslibrary(lakefetch)
# Use built-in example data
data("adirondack_sites")
# Get lake boundaries
lake <- get_lake_boundary(adirondack_sites)
# Calculate fetch
results <- fetch_calculate(sites = adirondack_sites, lake = lake)
# Visualize results
plot_fetch_map(results)
plot_fetch_bars(results)
# Launch interactive app (requires shiny, leaflet)
fetch_app(results)| Function | Description |
|---|---|
load_sites() |
Load sampling sites from CSV |
get_lake_boundary() |
Download lake boundaries from OSM or load from file |
fetch_calculate() |
Calculate directional fetch and exposure metrics |
plot_fetch_map() |
Map of sites colored by exposure category |
plot_fetch_bars() |
Bar chart of effective fetch by site |
plot_fetch_rose() |
Directional fetch rose diagram for a site |
fetch_app() |
Interactive Shiny app for exploration |
For each sampling site, lakefetch calculates:
If you have your own lake boundary shapefile or geopackage:
lake <- get_lake_boundary(sites, file = "my_lake_boundary.shp")
results <- fetch_calculate(sites, lake)# Requires nhdplusTools package
# install.packages("nhdplusTools")
results <- fetch_calculate(sites, lake, add_context = TRUE)
# Adds: outlet location, inlet locations, watershed area, connectivity classification# Add historical wind data for wave energy calculations
# Requires a datetime column in your sites data
results <- add_weather_context(results$results, datetime_col = "datetime")The package includes example datasets for testing:
adirondack_sites: Sampling sites from Adirondack lakes
(New York)wisconsin_lakes: Lake boundaries from Wisconsinexample_lake: Single lake polygon for testingcitation("lakefetch")MIT License
Issues and pull requests are welcome at GitHub.