stitchMatchedDistanceM

Recombine one MatchedRoute per chunks entry into a single trip distance, counting the overlap between consecutive chunks exactly once.

The subtle part. A chunk with overlapWithPrevious = k shares its first k points — and therefore its first k - 1 legs — with the tail of the chunk before it. Those k - 1 legs were already added when the previous chunk was folded in, so this drops exactly that many legs from the front of every chunk after the first before summing the rest. Get the count wrong in either direction and every multi-chunk trip is silently short or long by the overlap's own distance — the kind of error that never shows up on a single-chunk trace, only in production on the trips long enough to need chunking at all.

Requires MatchedRoute.legDistancesM on every chunk; a route that cannot report legs makes correct stitching impossible, so this refuses rather than approximate one from the aggregate MatchedRoute.distanceM.