| assign_sites_to_lakes | R Documentation |
Perform spatial join to assign each site to its containing lake polygon.
assign_sites_to_lakes(sites_sf, water_polygons, tolerance_m = NULL)
sites_sf |
sf object with site points |
water_polygons |
sf object with lake polygons |
tolerance_m |
Buffer distance for matching sites near lake edges |
sf object with sites and added columns for lake_osm_id, lake_name, lake_area_km2
csv_path <- system.file("extdata", "sample_sites.csv", package = "lakefetch")
sites <- load_sites(csv_path)
lake_data <- get_lake_boundary(sites)
# Assign sites to their containing lakes
sites_assigned <- assign_sites_to_lakes(
lake_data$sites,
lake_data$all_lakes,
tolerance_m = 50
)
# Check assignments
table(sites_assigned$lake_name)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.