Singapore Bus data
This is a data-only repository to complement BusRouter SG.
It's in the /data folder.
Or, browse through them on the data server: https://data.busrouter.sg/
- Stop - the bus stop itself
- Service - the bus service, with numbers like
133or1N - Route - the route of a bus service, the lines connecting all the stops
- Pattern - the patterns of a bus route, one of the lines connecting the stops
- If the route is one-way (A->B), there's only one pattern
- If the route is two-way (A->B, B->A), there're two patterns in a route
- Each pattern usually pass through different stops, as they're usually on opposite sides of the road.
Delete files in data/v1/raw/services/*, data/v1/patch/*.cm.json and data/v1/patch/*.om.json, before running the commands below.
fetch-bus-stops- Fetch all bus stops from https://www.lta.gov.sg/map/busService/bus_stops.xmlfetch-bus-services- Fetch bus services from https://www.lta.gov.sg/map/busService/bus_services.xmlfetch-bus-services-route- Fetch all the XMLs and KMLs e.g.: https://www.lta.gov.sg/map/busService/bus_route_xml/10.xml, https://www.lta.gov.sg/map/busService/bus_route_kml/10-1.kml and https://www.lta.gov.sg/map/busService/bus_route_kml/10-2.kml.
⚠️ This requiresDatamallAccountKeyenvironment variable. Make a copy ofexample.envfile, rename to.envand put in your Datamall API key.
fetch-bus-stops-datamall- Fetch all bus stops from http://datamall2.mytransport.sg/ltaodataservice/BusStopsfetch-bus-routes-datamall- Fetch all bus routes from http://datamall2.mytransport.sg/ltaodataservice/BusRoutes
patch-missing-routes- Patch missing routes (failed requests fromfetch-bus-services-route) by getting fresh route data from OneMap/Citymapper.patch-multiline-routes- Patch multi-line routes (routes that has more than one line, we only need one line here, per pattern) by getting fresh route data from OneMap (again).patch-bus-stop-names- Patch bus stop names (some of them are all-uppercase instead of titlecase) by double-checking them on https://www.transitlink.com.sg/eservice/eguide/bscode_idx.php
generate-data- Generate all the final clean datagenerate-data-firstlast- Generate the first/last timing data
Run all npm commands above.