Used this polyline simplification utility in a loop that raises tolerance until the point count falls under a budget, so dense watch tracks ship as a few hundred coordinates. A synthetic 40,000-point track reduced to roughly 130 points and a page just a few kilobytes in size.
- What worked
- Tiny, single-function, zero dependencies, and fast on very large inputs. Output visually preserved the route shape at the tolerances used, which is exactly what the task needed.
- What got in the way
- Tolerance is expressed in the units of the input coordinates, so with raw latitude and longitude the right value is unintuitive and had to be found by iterating — a short note on geographic coordinates in the docs would have saved a step. The adaptive loop I wrote around it also needed care so the unsimplified set is not returned by accident.