Download a subset of the NHDPlus v2.1 flowlines that covers a list of detection sites.

queryFlowlines(
  sites_sf = NULL,
  root_site_code = NULL,
  min_strm_order = 0,
  max_upstream_comid = NULL,
  combine_up_down = TRUE
)

Arguments

sites_sf

An `sf` class object containing points of all detection sites. Must contain a column named `site_code` containing the site code of each site.

root_site_code

Site code for the starting detection site.

min_strm_order

minimum stream order to query flowlines for. Default value is `0`.

max_upstream_comid

if provided, this function will filter out any flowlines upstream of this unique identifier (COMID) in the NHDPlus stream network. Default value is `NULL`. For assistance identifying a COMID, please see the `nhdplusTools` package, specifically the `discover_nhdplus_id()` function.

combine_up_down

Should the flowlines upstream and downstream of the starting point (`root_site_code`) be combined into a single object, or be returned as separate elements? The default value is `TRUE`

Value

list with at least two elements: `flowlines` is the `sf` object of flowlines downloaded from NHDPlus. `basin` is the polygon representing the catchment upstream of the root site. If `combine_up_down` is `FALSE`, there is a third element in the list, called `dwn_flowlines`, containing an `sf` object of flowlines downstream of the root site.

Author

Kevin See