Get Waterbody Outlet

get_wb_outlet(lake_id, network)

Arguments

lake_id

integer COMID (or character permenent identifier for hi res) of lake.

network

data.frame of network features containing wbareacomi, and Hydroseq

Value

sf data.frame with single record of network COMID associated with most-downstream reach in the NHD Waterbody

Examples

# \donttest{

source(system.file("extdata/sample_data.R", package = "nhdplusTools"))

fline <- sf::read_sf(sample_data, "NHDFlowline_Network")
wtbdy <- sf::read_sf(sample_data, "NHDWaterbody")

lake_COMID <- wtbdy$COMID[wtbdy$GNIS_NAME=='Lake Mendota 254']

get_wb_outlet(13293262, fline)
#> Simple feature collection with 1 feature and 136 fields
#> Geometry type: MULTILINESTRING
#> Dimension:     XYZM
#> Bounding box:  xmin: -89.38441 ymin: 43.09491 xmax: -89.37037 ymax: 43.09903
#> z_range:       zmin: 0 zmax: 0
#> m_range:       mmin: 0 mmax: 100
#> Geodetic CRS:  GRS 1980(IUGG, 1980)
#> # A tibble: 1 × 137
#> # Groups:   wbareacomi [1]
#>      comid fdate               resolution gnis_id gnis_name   lengthkm reachcode
#> *    <int> <dttm>              <chr>      <chr>   <chr>          <dbl> <chr>    
#> 1 13294312 2009-05-01 00:00:00 Medium     1577073 Yahara Riv…     1.27 07090002…
#> # … with 130 more variables: flowdir <chr>, wbareacomi <int>, ftype <chr>,
#> #   fcode <int>, shape_length <dbl>, streamleve <int>, streamorde <int>,
#> #   streamcalc <int>, fromnode <dbl>, tonode <dbl>, hydroseq <dbl>,
#> #   levelpathi <dbl>, pathlength <dbl>, terminalpa <dbl>, arbolatesu <dbl>,
#> #   divergence <int>, startflag <int>, terminalfl <int>, dnlevel <int>,
#> #   uplevelpat <dbl>, uphydroseq <dbl>, dnlevelpat <dbl>, dnminorhyd <dbl>,
#> #   dndraincou <int>, dnhydroseq <dbl>, frommeas <dbl>, tomeas <dbl>, …

# }