Skip to content

feat(map): zoom-driven TRACK marker LOD via screen-space simplification#82

Merged
techtimo merged 1 commit into
mainfrom
feat/lod-marker-visibility
May 6, 2026
Merged

feat(map): zoom-driven TRACK marker LOD via screen-space simplification#82
techtimo merged 1 commit into
mainfrom
feat/lod-marker-visibility

Conversation

@techtimo
Copy link
Copy Markdown
Owner

@techtimo techtimo commented May 6, 2026

Introduces LodManager, which hides/shows TRACK circle-dot markers in lockstep with Leaflet's own polyline smoothFactor rendering. On each zoomend, each feed's TRACK runs are projected to screen coordinates and passed through L.LineUtil.simplify (the same algorithm and tolerance as the polyline), so a marker is visible iff the polyline would show a bend at that point.

  • LOD activates only when total TRACK points across all feeds >= 10 000
  • The last TRACK point and all TRACK points within 24 h of it are always visible regardless of zoom level
  • start() is triggered by map.once('moveend') registered before fitBounds so the initial simplification fires at the correct zoom after the animation settles
  • refresh() short-circuits as soon as the 10 k threshold is confirmed, avoiding a full scan on every zoom event
  • Removes dead rebuildLinesForFeed() from LineManager (leftover from an earlier geographic-RDP approach that was superseded)

Introduces LodManager, which hides/shows TRACK circle-dot markers in
lockstep with Leaflet's own polyline smoothFactor rendering.  On each
zoomend, each feed's TRACK runs are projected to screen coordinates and
passed through L.LineUtil.simplify (the same algorithm and tolerance as
the polyline), so a marker is visible iff the polyline would show a bend
at that point.

- LOD activates only when total TRACK points across all feeds >= 10 000
- The last TRACK point and all TRACK points within 24 h of it are always
  visible regardless of zoom level
- start() is triggered by map.once('moveend') registered before fitBounds
  so the initial simplification fires at the correct zoom after the
  animation settles
- refresh() short-circuits as soon as the 10 k threshold is confirmed,
  avoiding a full scan on every zoom event
- Removes dead rebuildLinesForFeed() from LineManager (leftover from an
  earlier geographic-RDP approach that was superseded)
@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

❌ Patch coverage is 13.60000% with 108 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/map-engine/LodManager.ts 8.57% 96 Missing ⚠️
src/map-engine/LineManager.ts 0.00% 5 Missing ⚠️
src/map-engine/Spotmap.ts 50.00% 5 Missing ⚠️
src/map-engine/MarkerManager.ts 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@techtimo techtimo merged commit 0d26928 into main May 6, 2026
4 of 5 checks passed
@techtimo techtimo deleted the feat/lod-marker-visibility branch May 6, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant