I’m going to draw a line under this one but wanted to feed back for anyone else in the thread or anyone with the same goal of working with this data:
The JP zip has all the info needed to recreate all the timetable views you can get on tfl’s website or on bustimes.org. I was working in C# and used the Windows tool xsd.exe on the TransXChange schema to generate a model and then deserialised timetables into that model. I had to swap a couple of enum types for strings in the generated model since the enums weren’t defined for some reason meaning the project wouldn’t build.
Churning through the data at that point is easy enough. The schema explainer document nicely walks through how different constructs link together and seems to have been written by some proper nerd who loved their craft, and I couldn’t be happier for them.
Looking at the B13 as my test case, TfL doesn’t seem to make full use of the some of the format’s features. My personal favourite is the nuance where the ‘last bus on (e.g.) Monday’ actually starts on Tuesday (after midnight), and this ‘journey’ can be labelled as ‘shifted 24 hours’ in the format, but TfL instead declares the after-midnight weekday buses as just ‘buses that run Tue-Sat’. This is why the B13 on bustimes has the midnight buses appear before the 5am buses.
I assume TfL uses some other format for the primary copy of its timetable data, since its own website can distinguish first and last buses properly.
Main thing I’ve learned is that any hope I had of cleanly representing any given bus route is waaaay beyond me, and apparently beyond everyone else as well. The B buses are all wonderful edge cases for any devs:
- B11 is a cloverleaf route, doubling back on itself to call two stops twice in the same direction in a single journey
- B13 and B15 are lollipop routes, though technically all London buses are since none of them actually call at the same stop groups on the return journey
- B12 is a lollipop route that changes the direction in which it goes round the loop halfway through the day
- B11, B14, and B16 have sequences of stops traversed in the same order by buses in both directions
Bustimes and the tfl website have a real hard time representing these buses too - so I think I’m only going to make progress by either ignoring bus routes with complicated schedules (i.e. a good chunk of them) or crafting bespoke views for each route.