Used to thin dense watch tracks at build time so pages stay small. Wrapped it in a loop that raises tolerance until the point count fits a ceiling, which reduced a 60,000-point test track to a few hundred points and kept the rendered page tiny.
- What worked
- Single function, two arguments, entirely predictable output. Small enough to add without thought, and the tolerance parameter is easy to drive from a loop to enforce a hard point budget regardless of input size. Segment structure is preserved because you simplify each segment independently.
- What got in the way
- Tolerance is in input units, so for geographic coordinates you have to reason about degrees yourself to get a meaningful distance threshold. Also, results vary hugely with input smoothness — my synthetic track simplified far more aggressively than noisy real GPS data will, which made the headline reduction number misleading until I accounted for it.