trails/packages/map-core/src
Ullrich Schäfer c33a413395
feat(planner): store computed route compact-encoded (groups 2–4)
Wire the map-core codec into route-data.ts so the Yjs session doc stores
the computed route compactly, without changing the routing-host
compute-once-and-share model.

- Codec: add encodeElevations/decodeElevations (delta+varint) so geometry
  = encoded [lon,lat] polyline + elevation channel; precision bumped to
  1e6 (~0.11 m) to preserve the router's 6-decimal output.
- writeComputedRoute: geometry stored once (encoded polyline + elevations,
  no redundant geojson), road metadata run-length encoded.
- Dual-format reads: getCoordinates / readRoadMetadata / new readGeojson
  transparently handle the new encoding AND legacy JSON docs (+ oldest
  geojson-only) — no migration, no flag day; legacy docs re-encode on the
  next recompute. use-elevation-data reads readGeojson (assembled for new
  docs).
- Spec correction: a lossy compact codec can't be byte-identical to legacy
  (generateGpx emits raw precision), so "GPX byte-compatible" is corrected
  to "coordinates preserved within the router's ~0.1 m precision".

Tests: legacy-format read, size assertion (>4x smaller / round-trips),
elevation round-trip. map-core + planner typecheck/lint clean; full
pnpm test 11/11.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 17:07:28 +02:00
..
colors Add tests to all packages, remove passWithNoTests 2026-04-13 00:48:27 +02:00
index.ts feat(planner): store computed route compact-encoded (groups 2–4) 2026-07-15 17:07:28 +02:00
osmium-filters.sync.test.ts poi-index: extract pipeline (BRouter host) + import job (flagship) + e2e 2026-07-12 22:48:32 +02:00
poi-selectors-sql.sync.test.ts poi-index: extract pipeline (BRouter host) + import job (flagship) + e2e 2026-07-12 22:48:32 +02:00
poi.test.ts poi-index: map-core selectors, planner.pois schema, /api/pois route + client, metrics 2026-07-12 22:38:03 +02:00
poi.ts poi-index: map-core selectors, planner.pois schema, /api/pois route + client, metrics 2026-07-12 22:38:03 +02:00
route-codec.test.ts feat(planner): store computed route compact-encoded (groups 2–4) 2026-07-15 17:07:28 +02:00
route-codec.ts feat(planner): store computed route compact-encoded (groups 2–4) 2026-07-15 17:07:28 +02:00
snap.ts Extract @trails-cool/map-core package from Planner 2026-04-12 22:28:14 +02:00
surface-breakdown.test.ts route-surface-breakdown (Phase 1): Planner-path surface/waytype bars 2026-06-14 18:46:49 +02:00
surface-breakdown.ts route-surface-breakdown (Phase 1): Planner-path surface/waytype bars 2026-06-14 18:46:49 +02:00
tiles.test.ts Add tests to all packages, remove passWithNoTests 2026-04-13 00:48:27 +02:00
tiles.ts Extract @trails-cool/map-core package from Planner 2026-04-12 22:28:14 +02:00
z-index.ts Extract @trails-cool/map-core package from Planner 2026-04-12 22:28:14 +02:00