After the simulated commuter map I wanted to see real movement, the trains that are running right now. Swiss public transport publishes a realtime feed with the delays and cancellations of every train that reports them, so I added a train view for the same 16 cities.
The feed has no GPS. It tells me that train S7 18767 is 0.3 minutes late for Kloten, and nothing about where that train is. So every dot on this map is my own estimate: I take the station the train last left, the station it will reach next, the scheduled times plus the reported delay, and move the dot along the rail line between the two. If there is no rail line nearby, the dot waits at the station instead of cutting straight across a lake.
That estimate is the part I like most. The dots creep along the tracks second by second, and once a minute the new delays arrive and some trains shift forward or back to match them. Green trains are at most a minute late for their next stop, ochre trains one to five minutes, red trains more than five, and grey trains are cancelled.
Each train is labelled with its line and train number, so you can tell apart two S7 trains running at the same time. You can type a line, a train number or a station into the search box and the matching dots get bigger. Clicking a train puts a ripple around it, which helps if you are watching your own S-Bahn and wondering whether you will make the connection.
Data Sources & Methodology
Delays and cancellations come from the GTFS Realtime Trip Updates feed on opentransportdata.swiss. It is a single file for the whole country, between 35 and 66 MB depending on the time of day, and the API allows two requests a minute. A PHP script on my server downloads it once a minute and splits it into one file per city, so opening the page never touches the source.
The realtime feed only carries trip IDs, stop IDs and delays. Train numbers, station names and the order of stops come from the Swiss GTFS static timetable, which is republished twice a week. The realtime feed and the timetable have to be the same version, or trips get matched to the wrong trains, so an hourly job checks the version and rebuilds the timetable files when it changes.
The rail lines are the same ARE NPVM 2023 network I used for the commuter map, and station coordinates come from the DiDok station register. The position along that network is an estimate based on elapsed time. It does not tell you which track or route the train actually took.
A train appears only when the feed has a report for its next stop. Operators that do not publish realtime data are left out, so an empty stretch of map does not prove that nothing is running there. The color describes the delay at the next stop, not over the whole journey. The counter covers the trains inside the current map view, so it changes when you zoom or pan.