PocketTrack: Tracking shuttle buses is hard
…mostly because I’d have to redesign the entire thing
PocketTrack (formerly SammDOT Tracker) is a web-based tracker for Toronto Transit Commission surface vehicles (buses and streetcars).
When I first started working on the SammDOT Tracker back in April, I intended it to be little more than a proof of concept, and perhaps something only I would use. It was very simple, and really didn’t take much to write; each API request just forwarded to the NextBus API, and the data cleaned up and other data (PRESTO status and garage allocation) added after.
More recently, though, I’ve been finding more and more reasons to ditch that and actually design PocketTrack the right way this time around.
Shuttle buses!
Toronto’s favorite mode of public transit…
I worked as a part-time customer service ambassador (CSA) at the Toronto Transit Commission for about a year. My job was to answer customers’ questions and direct them to shuttle buses when the subway is closed, i.e. practically every weekend. One question I would get a lot:
When is the next shuttle bus coming?
Alternatively,
How often are the shuttle buses running?
I really don’t know. If I couldn’t see a bus up the street, I would have no idea how long it would take until the next one comes. One minute, three minutes, ten minutes?
Right now, PocketTrack can track all buses on a certain route. Unfortunately, this only works on the regular surface routes, 5 to 396 and 501 to 514; while shuttle buses do have their internal route numbers that could be used to track them, NextBus isn’t aware of them so it’s as if they’re Not In Service.
I tried an experiment once at work, with my supervisor’s permission, where a fellow CSA-slash-transit-enthusiast and I made a list of all the buses we spotted during our shift and tracked them all on PocketTrack. We ended up with a list of about 45 buses, which is typical for a medium-length closure. It was a bit of a pain typing them all out on our phones, but we had a pretty clear picture of how smoothly the shuttle buses were running and we could finally tell customers when the next bus was coming if they asked.
The problem is, that doesn’t scale. Buses switch all the time; there are two times in the day (around 1 pm and around 5 pm) when buses are sent back to the garage and new buses take their place, and we would have to keep track of the new buses too and see which old buses have left the shuttles.
I visited this weekend’s closure to talk to my other CSA-slash-transit-enthusiast friends, also users of PocketTrack. One of them tried to bounce some ideas off me for tracking shuttle buses: draw a ‘box’ around the route of the closure, within 50 meters or so of the street to correct for location reporting errors, and consider all buses within that ‘box’ shuttle buses.
I get what he’s getting at, and I have a simpler alternative that I suspect would be computationally cheaper: draw a path on the route of the closure (shuttle routes have mostly stayed the same anyway in the past year), and consider all buses within some distance of that path shuttle buses.
That’s probably the best way to go about tracking shuttle buses, but there are a few complications:
- Other in-service buses could be running on parts of the closure route, and those shouldn’t be considered shuttle buses. For example, the Line 1 shuttle between St. George and points north typically runs along Bathurst Street, overlapping with the 7 Bathurst bus. Are you supposed to consider those buses shuttles as well? Of course not.
- Operators that do extra work may continue to be logged onto a different route while running the shuttles. For example, if a Birchmount bus on route 69 Warden South were sent to a closure after its regular shift, the operator would stay logged on on route 69 while doing the closure. The only way to do this correctly is to check if such buses are off-route (a 69 bus should never be seen on, say, Bathurst Street).
- The destination signs on the buses do not show on NextBus. Sure, the bus might be showing a ‘LINE 1 SHUTTLE BUS / NORTHBOUND’ sign, but it’s listed as Not In Service. Or, there could be an actual Not In Service bus on that route and it could be mistaken for a shuttle bus because you don’t know what the sign says.
In order to be able to keep track of all those things, all the vehicle locations need to be placed in a database, which I don’t currently have. Since the tracker just requests the data directly from NextBus on each request, I haven’t had to store that data, but now with tracking shuttle buses it would definitely be a good idea to do so.