Stockholm Transit Live

Every bus, metro, tram
and boat — in real time

A free, publicly accessible map showing the live GPS positions of all SL public transport vehicles across Stockholm County. No login required.

Metro green
Metro red
Metro blue
Commuter trains
Trams
Buses
Boats

What the map shows

🚌

Live vehicle positions

GPS positions for all SL transport modes, fetched from Trafiklab every 2 seconds. A colour-coded ring shows punctuality: green on time, amber slightly late, red delayed.

🗺

Route geometry

Metro, tram and commuter rail lines drawn on the map. Vehicles snap to their tracks.

🚉

Departure boards

Click any station marker to see live next departures, updated every 30 seconds. Delayed departures show the expected time in amber with the scheduled time struck through.

🕐

Journey planner

Plan trips between any two stops with real-time departure times and transfer details. Search for a specific date and time, and choose to depart at or arrive by that time.

🌙

Light & dark theme

Switch between dark and light map styles. Your preference is remembered.

📱

Mobile friendly

Fully responsive — works on desktop, tablet and mobile without any app install.

Architecture

The server fetches vehicle positions from Trafiklab every 2 seconds and caches them in memory. All connected browsers are served from this single cache — meaning API call volume is fixed regardless of how many visitors are watching simultaneously. A separate GTFS-RT TripUpdates feed is polled every 30 seconds to provide real-time delay data for each trip.

1

Trafiklab GTFS-RT feed

SL's GPS vehicle positions are published as a GTFS Realtime protobuf feed, updated every 2 seconds. Fetched server-side using a Gold tier API key.

2

Flask backend

A Python/Flask server parses the protobuf feed, enriches vehicles with line info from the GTFS static dataset, and caches the result in memory.

3

Nginx reverse proxy

Nginx sits in front of Flask, caching the /api/vehicles response for 2 seconds to absorb traffic spikes while keeping data fresh.

4

Browser animation

The frontend polls every second and animates vehicle markers smoothly between positions using requestAnimationFrame. Rail vehicles snap to their track geometry.

Powered by Trafiklab

All transport data is provided by Trafiklab (Samtrafiken), the open data platform for Swedish public transport.

Source What it provides Update rate
GTFS Regional Realtime Live vehicle GPS positions for all SL modes Every 2s
GTFS Regional Static Route geometry, stop locations, line names Monthly
GTFS-RT TripUpdates Real-time delay data per trip Every 30s
SL Transport API Real-time departure boards per station Every 30s
SL Journey Planner v2 Trip planning between stops, with date/time support On demand

Built with

Component Technology
BackendPython · Flask · Gunicorn
FrontendVanilla JavaScript · Leaflet.js
Map tilesCartoDB Basemaps (dark & light)
Reverse proxyNginx · Traefik
InfrastructureDocker · Docker Compose · Self-hosted
AnalyticsPlausible CE (self-hosted, privacy-friendly)

No tracking, no ads

This site uses self-hosted Plausible Analytics — a privacy-friendly analytics tool that does not use cookies, does not collect personal data, and does not share data with third parties. No advertising. No login required.

Get in touch

Questions, feedback or suggestions? Reach out at stockholmtransit.live@gmail.com