R/flowline_reaches.R
derive_reach_flowlines.RdTransfers ordered Reach transitions from the retained Stream reference to a terrain-derived Flowline, then prepares one continuous Flowline per Reach.
derive_reach_flowlines(
raw_flowline,
smoothed_flowline,
reference_lines,
reach_mappings,
reaches,
dem,
connectivity_tolerance = 0.01
)One projected, downstream-to-upstream sf LINESTRING
selected from the synthetic Stream Network.
A smoothed version of raw_flowline with the same
fixed endpoints.
Ordered downstream-to-upstream retained Stream
reference lines with a unique selection_id field.
Data frame linking every retained selection_id to one
saved reach_id.
Saved Reach features or data frame with unique reach_id and
reach_name fields.
A terra::SpatRaster in the Flowline CRS. It is supplied to
flowline() for contract compatibility; saved topology remains the
direction authority.
Maximum permitted gap between consecutive reference lines, in reference CRS map units. Defaults to 0.01.
A list containing flowlines (one downstream-to-upstream feature per
Reach with legacy ReachName, from_measure, and to_measure
fields; measures are continuous kilometres from the selected Stream outlet),
boundaries (transferred Reach boundary points and projection evidence),
and reach_order.
Each Reach must occupy one contiguous block in the ordered retained Stream reference. Every reference line must be assigned exactly once. Reach boundaries are the shared or near-coincident endpoints between consecutive reference blocks. They are projected first to the raw terrain path, then to the smoothed path. Reversed, duplicated, gapped or collapsed transitions fail closed. Reach polygon edges are not used.