A better way to bus-surf in Singapore.
Finds the shortest bus-only path between two locations defined by GPS coordinates or 5-digit bus stop codes.
Uses a modified multi-origin A* algorithm with a custom cost function.
- Request an API key from LTA:
- Application is instantaneous and free
- Click here to apply
- Save api key as python variable in keys.py in project root
- api_key = 'paste_api_key_here'
- Download most up-to-date dataset
- Run update_dataset.sh
- Run route.py
Use the command line argument -h or --help at any point to display the help message.
usage: python route.py [-v] [-t TRANSFER_PENALTY] {coords,codes}
-
coords: Find the shortest bus route between 2 GPS coordinates
-
codes: Find the shortest bus route between 2 bus stop codes
-
-v: set verbose flag
-
-t TRANSFER_PENALTY: distance in km you would rather travel on the bus as opposed to spending the time & effort to make a transfer to another bus service
usage: python route.py coords [-h] [-o LAT LON] [-g LAT LON] [-r RADIUS]
-
-o LAT LON: origin lattitude and longitude in degrees
-
-g LAT LON: goal lattitude and longitude in degrees
- -r RADIUS: radius from both origin and goal you are willing to walk to/from a bus stop
usage: python route.py codes [-h] [-o ORIGIN [ORIGIN ...]] [-g GOAL]
-
-o ORIGIN [ORIGIN ...]: possible origin bus stop codes separated by spaces
-
-g GOAL: destination bus stop code