currentLocation field empty in Line/Arrivals API for all buses

I’m looking to identify actual positions of buses and the only option seems to be to use the Line/{ids}/Arrivals interface. I’ve seen how previous implementers have guesstimated position from the time to arrive at next stop, most notably the map on traintimes.org.uk but this is a very low accuracy approach, but fine within the scope of the interface.
The API has a field currentLocation, which seems to be always blank on buses and with a helpful definition of “The current location of the vehicle”. Could the API be enhanced to supply the Longitude and Latitude of the vehicle in this field? I assume the buses are sending them back anyway and given the very open-ended definition of the field, it wouldn’t seem to break the interface.

Cheers in advance

1 Like

Welcome @dsemal

Unofficially. As I recall the iBus system uses dedicated GPS hardware supplied by a third party and uses a public messaging system for bus-to-server and server-to-bus messages.

The GPS is actually quite good compared to a phone because it is using an external aerial, unlike in a mobile phone or tablet where the GPS aerial is part of the device.

For GPS to get a highly accurate location, it needs to compare as many signals from the different GPS satellites as possible. The location is worked out by comparing the timing of the reception of the data packet and knowing the path back, via the satellites to the reference point. The more signals, the better the accuracy.

So, out in a field the aerial can get as many satellite signals as is possible. However on city streets GPS becomes poor because the view of the sky from the receiver location reduces the accuracy just when you need it most.

This isn’t always a problem. One thing you can do is just “snap” the location calculation to the nearest street (or railway if you’re on a train). This is great for monitoring service buses because they tend to go in a single direction, run up to 30km/h, have terrible turning circles and can only reverse with a lot of effort.

So… to run a system like “iBus” you can take these assumptions and use them to predict where a bus is with a reasonable level of accuracy from the GPS data, but not 100% precisely.

Also, bus software doesn’t have access to the “location services” which use GSM tower location data and wifi-network location data to enhance the GPS derived location.

So, I don’t think TfL want to put “accurate” lat, long data out there because someone (like me, no doubt) will come back and point out how wrong it is.

So, that’s why you get told that a bus is “at” so-and-so stop or “3 mins between” some other pair of stops. That’s because it’s actually the precision of data they have.

Perhaps in future “bus ticket machines” will be able to use iOS/Android to get better live locations.

Hi dsemal,

I wanted to let you know that there is an ongoing work to provide the real time position of buses. We are working on providing a new API with bus location, direction, route, vehicle ID etc…
It’s a quite complex integration and we are hoping to get the new end point ready by March '21.

We will be posting here more information about this data once we know more precisely the delivery date, so stay tuned!

Kind regards,
Jakub

2 Likes

Hi @JakubGasiorowski,

Thanks for this update. Like @dsemal I’ve been looking for a way to do this for my own application too. But could you explain how traintimes.org.uk is able to do this already? Surely there is an existing API/feed that allows for this to happen?

Thanks

@nathanodong

There’s no official GPS feed from Darwin, so traintimes.org.uk is derriving this from the existing data. IMHO they don’t do it very well because they don’t use a very good model of the train acceleration/decelleration charactsitics. Which would require the collection of data…

We’ve been waiting for real GPS data to be added to Darwin for quite a while now. The update that was supposed to include it was rolled back because it failed.

NRE Darwin is free and is here - https://www.nationalrail.co.uk/100296.aspx

The pushport is the thing you need for realtime updates.

Hmm, I see. So for the bus tracking part of the site, it’s probably just using the eta from the API and some collection of average speed data to find it’s rough location? It would be interesting to see how it behaves in heavy traffic, as this would probably break it!

EDIT: I’ve just been comparing this feature to CityMapper. Looks like they do it a bit better, but I guess they’d have that huge dataset to play with.

I find that the Google Maps history “raw data” is quite useful to work out where buses actually go.

Go to https://www.google.co.uk/maps/timeline and then click on the cog in the bottom right and pick “show raw data”. It shows you both the location AND error for each point (you have to hover).