Skip to content
ES — View this page in SpanishEN

N° 02.01 — Case

Open source

Live

Rev ff2c27c

Metrovivo Santiago

Santiago's Metro network in 3D, every train in sync with the official timetable.

Type
Open source
Disciplines
  • AW Web applications
  • FS Full-stack development
Stack
JavaScript · three.js · GSAP · Vite · Vitest · Playwright · GTFS

Santiago's Metro network in 3D over a dark grid: seven coloured lines with stations as white dots, a note that the trains are a simulation of the official timetable, and controls for lines, 3D or 2D view, buses and speed.
FIG. 01 — Capture of the live site, Nov 2, 2026

Summary

Metrovivo draws Santiago's Metro network in 3D and 2D with a single three.js renderer. Every train sits where the official timetable says it should: its position is a deterministic function of the time in America/Santiago, derived from published headways and a physical speed profile, not from random animation. Click a train and the camera flies into its cab.

The data comes from DTPM's official GTFS feed. The script that downloads it rejects the undated file that still circulates in tutorials and refuses to run on an expired feed, because in this domain failure isn't a 404: it's a perfectly valid response full of stale data.

The simulation is a pure function, with no DOM and no renderer, which is why the whole engine is unit-tested. Everything else consumes a single contract, PositionProvider, which doesn't know where positions come from: it's the seam for the day real train data exists. Buses are the exception, since they do show measured positions, and that's why they're drawn blurrier than the trains: they're an uncertain measurement, not an exact fiction.

Metrovivo is not affiliated with Metro de Santiago or DTPM and doesn't use their logo. Train positions are simulated and must not be used to plan a trip.


01Problem

Santiago's Metro publishes no live train positions. For service status, the only feed a static site can read is a community API that answers 200 and "OK" with an empty network, reporting no issues even while a station is closed. Showing that false "all clear" would be worse than showing nothing.


02Decision

Simulate from the official timetable, and say so, rather than show live data that lies.

src/provider.js, lines 21 to 31, commit f5c74f2View on GitHub (external site)
export class ScheduleProvider {  constructor(sim) {    this._engine = sim;  }  /** Posiciones = f(hora oficial en America/Santiago). */  update(sec, day) { return this._engine.update(sec, day); }  get trains() { return this._engine.trains; }  get byKey() { return this._engine.byKey; }  get byId() { return this._engine.byId; }
  1. Line 21 Today's only implementation is the timetable. Everything else consumes the contract and never learns where positions come from.
  2. Line 27 Positions are a function of official time in America/Santiago.


04Architecture

  1. 01 DTPM GTFS feed
    • leads to 02 scripts/build-data.js
  2. 02 scripts/build-data.js
    • leads to 03 data/network.json
  3. 03 data/network.json
    • leads to 04 Simulation: f(time, day type)
  4. 04 Simulation: f(time, day type)
    • leads to 05 PositionProvider
  5. 05 PositionProvider
    • leads to 06 Network · Trains · Cab · LED
  6. 06 Network · Trains · Cab · LED
FIG. 02 — 6 nodes · 5 edges