Railrailrail
🚇 Route planner for all stages of the Singapore MRT/LRT rail network (1987-2040+).
Install / Use
/learn @elliotwutingfeng/RailrailrailREADME
railrailrail finds fastest routes between any 2 stations on the Singapore MRT/LRT rail network. It supports all known past and future stages of the network (1987-2040+).
Features
- Preset configurations for all known stages of the MRT/LRT network, in the TOML file format.
- Customize every station-to-station travel time, interchange transfer time, and station dwell time, by editing the TOML config file directly.
- Optionally enable walking routes between nearby stations.
- Find the circuity ratio of a fastest route. The circuity ratio is the total distance travelled divided by the great-circle (haversine) distance between origin station and destination station. Smaller circuity ratio implies a more direct and efficient route.
Requirements
- Python 3.14+
- uv 0.9.15+
- GNU Make
Works natively on a POSIX/UNIX-like environment like Linux/macOS. Windows users should use the Windows Subsystem for Linux.
Setup
Install dependencies. Then generate a coordinates file (station_coordinates.csv), and network config files for all stages.
These files will be saved to the config/ folder.
make install
make generate_config
Basic Usage
Now lets find the fastest route between Pasir Ris and Hougang in 2003.
uv run python src/railrailrail/cli.py route --network-file config/network_nel.toml --coordinates-file config/station_coordinates.csv --start EW1 --end NE14
# Start at EW1 Pasir Ris
# Board train towards terminus EW27 Boon Lay
# Alight at EW13 City Hall
# Transfer to NS25 City Hall
# Board train towards terminus NS1 Jurong East
# Alight at NS24 Dhoby Ghaut
# Transfer to NE6 Dhoby Ghaut
# Board train towards terminus NE17 Punggol
# Alight at NE14 Hougang
# Total duration: 61 minutes 28 seconds
# Approximate path distance: 28.1 km, Haversine distance: 6.3 km, Circuity ratio: 4.4
In 2024.
uv run python src/railrailrail/cli.py route --network-file config/network_tel_4.toml --coordinates-file config/station_coordinates.csv --start EW1 --end NE14
# Start at EW1 Pasir Ris
# Board train towards terminus EW33 Tuas Link
# Alight at EW8 Paya Lebar
# Transfer to CC9 Paya Lebar
# Board train towards terminus CC29 HarbourFront
# Alight at CC13 Serangoon
# Transfer to NE12 Serangoon
# Board train towards terminus NE17 Punggol
# Alight at NE14 Hougang
# Total duration: 49 minutes 26 seconds
# Approximate path distance: 19.6 km, Haversine distance: 6.3 km, Circuity ratio: 3.1
In 2030.
uv run python src/railrailrail/cli.py route --network-file config/network_crl_1.toml --coordinates-file config/station_coordinates.csv --start EW1 --end NE14
# Start at EW1 Pasir Ris
# Transfer to CR5 Pasir Ris
# Board train towards terminus CR13 Bright Hill
# Alight at CR8 Hougang
# Transfer to NE14 Hougang
# Total duration: 13 minutes 41 seconds
# Approximate path distance: 7.3 km, Haversine distance: 6.3 km, Circuity ratio: 1.1
Customization
The generated network config files (ending with .toml) and the station coordinates file (station_coordinates.csv) in the config
folder can be customized. See CONFIG.md.
Commands
See COMMANDS.md.
Misc
See MISC.md.
Analysis
A Jupyter notebook for analysing the route planner output is available at analysis.ipynb.
License
Source code is under Apache-2.0. Most of the datasets are under the Singapore Open Data Licence version 1.0.
See LICENSE and LICENSE-DATASET.md.
References
- Train Spotters from YouTube
- Measured interchange transfer times by a deleted user on Reddit
- TransitLink
- SMRT
- SBS Transit
- Singapore Train Station Coordinates
Related Skills
node-connect
347.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
