garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

.. /docs/adr/024-transit-live-boards.md

raw

ADR-024: Live Transit Departure Boards (OVapi)


Metadata:


Context

Problem: The transit data layer (ADR-023) shows where stops are, but a stop is only alive if you can see what's coming: the next buses/trams with real departure times. That needs a live feed, keyed per stop, and a correct notion of current wall-clock time.

Requirements:

Decision

Poll OVapi (http://v0.ovapi.nl), the open real-time feed for all Dutch public transport, and render an egui departure board anchored above each nearby stop pin.

Approach (systems/transit_live.rs): OSM stops carry ref:IFOPT (NL:Q:10006090); the numeric suffix is OVapi's timing-point code — a direct join, no lookup table. A worker thread issues one batched /tpc/{code,…} request per 30 s covering the ≤40 nearest stops within 800 m. A WorldClock resource tracks unix time; OVapi's naive-local timestamps are converted using the UTC offset the feed reports in LastUpdateTimeStamp (+0200/+0100), so DST is the feed's problem and the client needs only std date math. Boards are egui overlays projected from the pin anchors (max 8, nearest within 500 m), showing line, destination, and minutes-to-departure with delay/cancellation colouring.

Rationale

Primary Reasoning:

  1. Zero-friction join: ref:IFOPT is tagged on effectively every Dutch stop; verified live that codes resolve and OVapi coordinates match the OSM nodes within metres.
  2. Batching makes it performant: one ~20 KB request per interval covers a whole screenful of stops (~120 ms measured), regardless of stop count.
  3. The feed is its own timezone authority: parsing the reported offset avoids both a chrono/tz dependency and the classic naive-local-as-UTC bug.

Alternatives Considered:

AlternativeProsConsRejected Because
NDOV raw feeds (KV6/KV78turbo)Authoritative, push-basedRegistration, ZeroMQ plumbing, per-operator formatsHeavier than a client-side overlay needs
GTFS-Realtime aggregatorsWorldwide patternNo single open worldwide endpoint; per-feed keys and formatsRight direction for non-NL later, not for v0
3D text boards in-worldPrettier, diegeticNeeds a text-to-texture pipeline Bevy lacksegui overlay ships now; 3D skin can replace the renderer later without touching the data path

Consequences

Positive:

Negative:

Related