garage44.eu/jeroen/cartopolis

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

.. /docs/adr/026-live-transit-vehicles.md

raw

ADR-026: Live Transit Vehicle Positions (OVapi GTFS-Realtime)


Metadata:


Context

Problem: The transit layer shows where stops are (ADR-023) and when the next bus leaves (ADR-024), but not where the buses are right now. Live moving vehicles on the map (as https://transit.reppie.org/ does for NL) make the layer feel alive and are the natural companion to the departure boards.

Requirements:

Decision

Poll OVapi's GTFS-Realtime vehicle-position feed (https://gtfs.ovapi.nl/nl/vehiclePositions.pb) — one small protobuf covering all live Dutch vehicles — on a worker thread, and drive one coloured box mesh per nearby vehicle that glides between successive fixes.

Approach (systems/transit_vehicles.rs):

Rationale

Primary Reasoning:

  1. Same provider, complementary data: OVapi already backs the boards; its GTFS-Realtime side supplies positions with no new account or key.
  2. A tiny hand-rolled decoder beats a codegen dependency: only ~6 field reads off a stable schema; matches the codebase's other hand-rolled parsers and avoids prost + a build.rs. Verified against the live feed (parses all ~140 active vehicles, valid coordinates).
  3. Bounded and smooth: one shared cuboid + two materials, ≤80 entities, no per-frame asset churn — safe under the device-loss guardrails; motion interpolation hides the sparse, bearing-less fixes.

Alternatives Considered:

AlternativeProsConsRejected Because
prost + generated GTFS-RT schemaStandard, completeNew heavy dep + build codegen for 6 fields; own ADR for the dependencyOverkill; a minimal reader is enough and lighter
NDOV KV6 push feedAuthoritative, includes speed/bearingRegistration, ZeroMQ, per-operator formatsHeavier than a client overlay needs (same reason as ADR-024)
GPS bearing from the feedExact headingField is absent in this feed (0/140 carry it)Not available; heading derived from motion instead
Real bus glTF modelDiegetic, recognisableModelling/animation workPlaceholder box ships now; the renderer can be swapped without touching the data path

Consequences

Positive:

Negative:

Related