pub fn merge_lines(
lines: impl IntoIterator<Item = LineString>,
tolerance: f64,
) -> Result<Vec<LineString>, Error>Expand description
Merge original line parts through degree-two endpoint joins, preserving interior junctions.
This independent Rust implementation uses a chain pass followed by a cycle pass. Each original part is visited once. Index construction and contact queries are separate from the linear traversal. The input coordinates are never modified in place. Tolerance uses planar input coordinate units. Consecutive duplicate coordinates are removed; degenerate parts are skipped. Output order follows the earliest contributing part. Direction follows the majority of original part directions, with ties resolved by the earliest part. Output carries no feature provenance.
ยงErrors
Returns Error::Tolerance for negative or non-finite tolerance and
Error::NonFiniteLine for non-finite input coordinates.