Map (Geographic)
Track geometry as GeoJSON for Tube, Elizabeth, Overground, DLR, and Tram. Use the packaged MapLibre map, or draw the same files in your own SDK.
Preview
MapLibre GL JS on OpenFreeMap Positron (vector). No API key. Station names appear as you zoom.
Usage
Installation
pnpm dlx shadcn@latest add https://tfl.manglekuo.com/r/tfl-geographic-map.jsonThis copies the component, types, and credit helpers. The GeoJSON still has to live somewhere your app can fetch. Copy public/data/geography/*.json into the project, or host those files on a CDN.
Unique corridors, not every variant
OpenStreetMap stores each timetable pattern as its own route. Paint all of them and the Elizabeth line stacks 24 times on the same tracks. Tube would be 208 lines on 42 corridors.
What the map draws is the unique track. Longest spine, leftover branches, then simplified. Those files are served from /data/geography/. Full OSM variants stay in the repo for analysis. Do not put them on the map.
| File | Unique tracks | OSM variants | Stations |
|---|---|---|---|
tube-geometry.json | 42 | 208 | 270 |
elizabeth-geometry.json | 6 | 24 | 41 |
overground-geometry.json | 12 | 50 | 112 |
dlr-geometry.json | 6 | 12 | 45 |
tram-geometry.json | 3 | 10 | 38 |
all-stations.json is the same 456 stations with merged line ids. Rebuild unique-track with pnpm geography:unique-track.
Coming next
Bus route geometry and live bus or train positions belong here as optional geographic layers, not as separate mode-specific map products. Data coverage, freshness, vehicle identity, and stale positions still need investigation before those layers can ship.
Draw it in your own map
The files are GeoJSON. MapLibre and Leaflet need no key. Mapbox and Google Maps need a token from your project.
MapLibre GL JS
Leaflet
Mapbox GL JS
Needs a public access token.
Google Maps
Needs a Maps JavaScript API key.
Props
TflGeographicMap fills its parent. Give the wrapper a height.
| Prop | Type | Default |
|---|---|---|
| data | Record<TransitMode, Bundle> | fetches vendored JSON |
| modes | TransitMode[] | all five |
| showStations | boolean | true |
| showLines | boolean | true |
| showNavigation | boolean | true |
| center | [lng, lat] | [-0.12, 51.51] |
| zoom | number | 10.2 |
| className | string |
Track data still belongs to OSM
Geometry is © OpenStreetMap contributors, ODbL 1.0. Station metadata where present is © Transport for London, TfL Open Data. The Positron basemap is © OpenStreetMap contributors and © OpenFreeMap. The full declaration is data/geography/ORIGIN.md.