Add route snapping using OSRM - #85
Draft
konewka17 wants to merge 4 commits into
Draft
Conversation
Snaps raw GPS traces to the road network via the public OSRM match endpoint when snap_to_road is enabled. Results are cached in localStorage and applied progressively — raw polylines show immediately, each segment updates as its snapped route arrives, mirroring the reverse geocoding pattern. https://claude.ai/code/session_014gh3vpxy9ZNMT75MAdFFph
The public OSRM demo server enforces a low max_matching_size that rejects requests with more than ~10 trace coordinates (returns TooBig error). OSRM still returns a full road-following geometry with overview=full even from just 10 evenly-spaced sample points, so snapping quality is unaffected for typical trips. https://claude.ai/code/session_014gh3vpxy9ZNMT75MAdFFph
_drawMapPaths() previously called _fitMapToCurrentMode() unconditionally, causing the map to re-zoom every time a background update (OSRM snapping, reverse geocoding) triggered a re-render. Fix by gating the fit behind a _mapFitPending flag that is set by navigation events (_resetMapFitMode, entity switch) and consumed once by the next draw. Progressive updates call _render() but never set the flag, so the user's map position is preserved. https://claude.ai/code/session_014gh3vpxy9ZNMT75MAdFFph
konewka17
marked this pull request as draft
July 26, 2026 08:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See #82