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+).
- 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 distance between origin station and destination station. Smaller circuity ratio implies a more direct and efficient route.
- Python 3.12+
- Python Poetry
- GNU Make
Works natively on a POSIX/UNIX-like environment like Linux/macOS. Windows users should use the Windows Subsystem for Linux.
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
Now lets find the fastest route between Pasir Ris and Hougang in 2003.
poetry run python 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.
poetry run python 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.
poetry run python 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
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.
See COMMANDS.md.
See MISC.md.
A Jupyter notebook for analysing the route planner output is available at analysis.ipynb.
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.
- Train Spotters from YouTube
- Measured interchange transfer times by a deleted user on Reddit
- TransitLink
- SMRT
- SBS Transit
- Singapore Train Station Coordinates