Get ids for all streams segments moving up (default) or down from a starting stream segment (identified with `id`). Follow the largest accumulation tributary at confluences when moving upstream.

get_streams(net, id, mode = "up")

Arguments

net

stream network from `get_network` (SpatVector)

id

id of the starting stream segment (integer)

mode

type of extraction : upstream from id (`up`, default), upstream including all tributaries (`up_all`) or downstream from id (`down`).

Value

If `mode` is `up` (default) returns a vector with the upstream ids. If `mode` is `up_all` returns a dataframe with the first line corresponding to the main stream, and following lines to tributaries. The column `ids` contains the ids of the stream segments, `length` the total length of the stream and `n` the number of segments. If `mode` is `down` returns a vector with the downstream ids.