Get the ID of the basin outlet for each flowline. This function has been deprecated in favor of get_sorted.

get_terminal(x, outlets)

Arguments

x

two column data.frame with IDs and toIDs. Names are ignored.

outlets

IDs of outlet flowlines

Value

data.frame containing the terminal ID for each outlet

Examples

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

fl <- dplyr::select(prepare_nhdplus(walker_flowline, 0, 0),
                    ID = COMID, toID = toCOMID)
#> Warning: removing geometry
#> Warning: Removed 0 flowlines that don't apply.
#>  Includes: Coastlines, non-dendritic paths, 
#> and networks with drainage area less than 0 sqkm, and drainage basins smaller than 0

outlet <- fl$ID[which(!fl$toID %in% fl$ID)]

get_terminal(fl, outlet)
#> Deprecated, use get_sorted.
#>         ID terminalID
#> 1  5329303    5329303
#> 2  5329293    5329303
#> 3  5329305    5329303
#> 4  5329317    5329303
#> 5  5329315    5329303
#> 6  5329339    5329303
#> 7  5329343    5329303
#> 8  5329357    5329303
#> 9  5329365    5329303
#> 10 5329373    5329303
#> 11 5329385    5329303
#> 12 5329821    5329303
#> 13 5329395    5329303
#> 14 5329397    5329303
#> 15 5329389    5329303
#> 16 5329435    5329303
#> 17 5329313    5329303
#> 18 5329311    5329303
#> 19 5329817    5329303
#> 20 5329323    5329303
#> 21 5329325    5329303
#> 22 5329327    5329303
#> 23 5329347    5329303
#> 24 5329291    5329303
#> 25 5329363    5329303
#> 26 5329819    5329303
#> 27 5329359    5329303
#> 28 5329333    5329303
#> 29 5329371    5329303
#> 30 5329375    5329303
#> 31 5329377    5329303
#> 32 5329379    5329303
#> 33 5329399    5329303
#> 34 5329405    5329303
#> 35 5329427    5329303
#> 36 5329413    5329303
#> 37 5329419    5329303
#> 38 5329391    5329303
#> 39 5329407    5329303
#> 40 5329387    5329303
#> 41 5329415    5329303
#> 42 5329355    5329303
#> 43 5329337    5329303
#> 44 5329335    5329303
#> 45 5329345    5329303
#> 46 5329341    5329303
#> 47 5329321    5329303
#> 48 5329841    5329303
#> 49 5329815    5329303
#> 50 5329319    5329303
#> 51 5329309    5329303
#> 52 5329307    5329303
#> 53 5329299    5329303
#> 54 5329297    5329303
#> 55 5329295    5329303
#> 56 5329849    5329303
#> 57 5329393    5329303
#> 58 5329871    5329303
#> 59 5329383    5329303
#> 60 5329847    5329303
#> 61 5329845    5329303
#> 62 5329843    5329303