Calculate fetch (open water distance) and wave exposure metrics for freshwater lake sampling sites.
Fetch is the unobstructed distance that wind can travel across open water. It is a key physical driver in lakes because it controls wave height, wave energy, and shoreline exposure. Fetch influences sediment resuspension, nutrient cycling, littoral habitat structure, and the distribution of aquatic organisms. Despite its importance, calculating fetch for inland lakes has required either manual GIS work or tools designed for coastal/marine environments that do not handle the irregular shorelines and small spatial scales typical of lakes.
lakefetch fills this gap by providing an end-to-end R workflow for freshwater fetch analysis: it downloads lake boundary polygons from OpenStreetMap, calculates directional fetch via a ray-casting algorithm, classifies sites by wave exposure, and optionally integrates weather data to estimate cumulative wave energy. It can also pull hydrological context (outlets, inlets, watershed area, connectivity) from the US National Hydrography Dataset (NHD) via the hydrogeofetch package. The package is designed for batch processing across many lakes and sites, making it practical for large-scale ecological and limnological studies.
Other R packages calculate fetch for related use cases. fetchR, waver, and windfetch target coastal/marine environments and require the user to supply coastline polygons; lakemorpho computes fetch as one of many morphometric parameters on a single user-supplied lake polygon. lakefetch is distinguished by its lake focus and automatic OpenStreetMap-based boundary download for batch workflows. See Similar Packages below for a detailed comparison.
lakefetch operates on two-dimensional geographic
(curvilinear) coordinates. Input data are expected as
latitude/longitude pairs (WGS84, EPSG:4326) or as sf
objects in any CRS. Internally, all spatial calculations are performed
in a projected Cartesian coordinate system (UTM zone
automatically determined from site locations) to ensure accurate
distance measurements in meters. The package uses the sf package for
all spatial operations and is compliant with PROJ6+ and WKT2 coordinate
reference system representations.
Install from CRAN:
install.packages("lakefetch")Or install the development version from GitHub:
# install.packages("remotes")
remotes::install_github("ropensci/lakefetch")library(lakefetch)
# Load sampling sites from a CSV with latitude/longitude columns
sites <- load_sites(system.file("extdata", "sample_sites.csv", package = "lakefetch"))
# Download lake boundaries from OpenStreetMap
lake <- get_lake_boundary(sites)
# Calculate fetch for all sites
results <- fetch_calculate(sites, lake)
# View results - an sf object with fetch values and exposure categories
results$resultslakefetch_options(angle_resolution_deg = 10)) and
measuring the distance to the nearest shoreline in each direction.For each site, lakefetch returns:
| Metric | Description |
|---|---|
fetch_0 … fetch_355 |
Distance to shore (m) at each compass bearing |
fetch_mean |
Mean of all directional fetches |
fetch_max |
Maximum directional fetch (longest open water distance) |
fetch_effective |
Effective fetch (default: mean of 3 highest directional values) |
exposure_class |
Categorical exposure classification |
Three effective fetch methods are available: "top3"
(default), "max", and "cosine" (the SPM/CERC
cosine-weighted method from the Shore Protection Manual).
library(lakefetch)
# Built-in example data
data("adirondack_sites")
# Download lake boundaries from OpenStreetMap
lake <- get_lake_boundary(adirondack_sites)
# Calculate fetch with depth estimation
results <- fetch_calculate(sites = adirondack_sites, lake = lake)
# Visualize
plot_fetch_map(results) # Map colored by exposure class
plot_fetch_bars(results) # Bar chart of effective fetch
plot_fetch_rose(results, 1) # Rose diagram for the first site
# Interactive Shiny app
fetch_app(results)| Function | Description |
|---|---|
load_sites() |
Load and validate sampling sites from CSV or data frame |
get_lake_boundary() |
Download lake polygons from OSM or load from local file |
fetch_calculate() |
Calculate directional fetch, effective fetch, and exposure class |
add_lake_depth() |
Estimate lake depth from surface area (Cael et al. 2017) |
add_lake_context() |
Add NHD hydrological context (US lakes; requires hydrogeofetch) |
add_weather_context() |
Add historical weather and wave energy metrics (requires jsonlite) |
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 single site |
fetch_app() |
Interactive Shiny app for exploring fetch results |
fetch_app_upload() |
Standalone Shiny app with CSV upload (no coding required) |
If you have your own lake boundary as a shapefile or geopackage:
lake <- get_lake_boundary(sites, file = "my_lake_boundary.gpkg")
results <- fetch_calculate(sites, lake)Small water bodies not in OpenStreetMap: Very
small lakes and ponds (e.g., prairie ponds, stock tanks) may not be
mapped in OpenStreetMap. If no boundary is found,
get_lake_boundary() will error with a message suggesting
that you supply your own boundary file via
get_lake_boundary(sites, file = "your_boundary.gpkg").
Boundary files can be shapefiles, geopackages, or any format readable by
sf::st_read().
OpenStreetMap data quality: Lake boundaries in OSM vary in accuracy and completeness by region. For high-precision studies, consider using authoritative hydrography datasets (e.g., NHD for the US) as boundary sources.
Several R packages calculate fetch or wave exposure, but they target different use cases:
| Package | Focus | Key Differences |
|---|---|---|
| fetchR | General fetch calculation | Requires user-supplied coastline polygons; no automatic boundary download; single-polygon workflow; no batch multi-lake processing. |
| waver | Wave energy for coastal sites | Designed for marine/coastal environments; uses a different fetch algorithm (wedge-based); no lake-specific features like NHD integration or depth estimation. |
| windfetch | Wind fetch for coastal environments | Successor to fetchR; coastal focus; no OpenStreetMap integration or multi-lake batch processing. |
| lakemorpho | Lake morphometry metrics | Calculates fetch as one of many morphometric parameters (shoreline development, max length/width, volume); single-lake focus; requires user-supplied polygon; no wave energy, weather integration, or exposure classification. |
lakefetch is distinguished by its focus on freshwater lakes, including: automatic lake boundary download from OpenStreetMap with spatial clustering for large datasets, batch processing of sites across multiple lakes, empirical depth estimation, NHD hydrological context for US lakes, and historical weather/wave energy integration. These features are designed for the common ecological workflow of analyzing field sampling sites across many lakes.
The package includes three built-in datasets:
adirondack_sites: Sampling sites from lakes in the
Adirondack region of New Yorkwisconsin_lakes: Sampling sites on three Wisconsin
lakes (Mendota, Monona, Geneva)example_lake: A single lake polygon for testing and
examplesIf you use lakefetch in your research, please cite:
Farrell J (2026). lakefetch: Calculate Fetch and Wave Exposure for Lake Sampling Points. R package version 0.1.3, https://github.com/ropensci/lakefetch.
Or in BibTeX format:
@Manual{,
title = {lakefetch: Calculate Fetch and Wave Exposure for Lake Sampling Points},
author = {Jeremy Lynch Farrell},
year = {2026},
note = {R package version 0.1.3},
url = {https://github.com/ropensci/lakefetch},
}To generate the citation from R:
citation("lakefetch")This package was developed collaboratively with Claude (Anthropic).
Claude contributed to all aspects of the codebase, including package
architecture, function implementation, test writing, documentation, and
CI/CD configuration. All code was reviewed and directed by the package
author. Claude is credited as co-author on all commits via
Co-Authored-By tags.
Contributions are welcome. Please see CONTRIBUTING.md for guidelines on reporting bugs, suggesting features, and submitting pull requests.
Please note that the lakefetch project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
MIT License