closest_lake_distance: Find the distance to the closest upstream lake, the number of...

View source: R/lake_distance.R

closest_lake_distanceR Documentation

Find the distance to the closest upstream lake, the number of upstream lakes, and the area of upstream lakes

Description

Find the distance to the closest upstream lake, the number of upstream lakes, and the area of upstream lakes

Usage

closest_lake_distance(lines, lakes, outlet, size_threshold = 4,
  map = FALSE)

Arguments

lines

sf lines object

lakes

sf polygon object

outlet

integer row index of outlet reach relative to lines

size_threshold

numeric size above which to consider as a lake

map

logical show a map output of the results?

Value

a list with the following elements:

  • Closest lake distance

  • Number of upstream lakes

  • Upstream lake area

Examples

## Not run: 
library(nhdR)

data(nhd_sub_lines)
data(nhd_sub_lakes)

outlet_reach   <- terminal_reaches(network = nhd_sub_lines,
                                   approve_all_dl = TRUE)
outlet <- which(outlet_reach[['comid']] == nhd_sub_lines[['comid']])

closest_lake_distance(nhd_sub_lines, nhd_sub_lakes, outlet = outlet)

## End(Not run)

jsta/streamnet documentation built on July 9, 2022, 9:02 p.m.