When stitching pieces back together, join by the source's order, not by proximity — with a piece missing, nearest-neighbor greedy jumps ahead and backtracks
Stitching GPX track segments by 'nearest endpoint first' makes the route go forward, double back, and inflate its total length. Nearest-neighbor greedy is only right when every piece is present; with one missing it grabs a piece beyond the gap and comes back, so join by the source's order number, fill gaps separately, and count backtracking as point pairs visited twice.

