Problem with getting right bus stop ID

Hi there

This is a bit of follow up on my previous post, I am running a python code to obtain bus stop but I am not getting correct ID, for example when I search on TFL website trough their API for Rectory Grove I am getting ID back as 490G00009410, @mjcarchive suggested that I need to add W for West or N for North.

So my question is how to add get the correct ID from the API? do I make some mistake?

many thanks

@xxvms
It is not adding a suffix. It a quite different form of code starting 4900 rather than 490G.

I’ll leave it to others about getting the code from the API but If you are only interested in a few stops, you can get them via something ad hoc like this without bothering with API calls.

  • go to https://bustimes.org/
  • select a route number that you know serves the stop (e g 264)
  • select the TfL route (usually highlighted by a red background
  • when the timetable appears, select the Map option
  • select the stop you want, a bubble with the stop name then appears
  • click on the link in this bubble and the code (and much more) appears

No doubt better ad hoc approaches are available. I’m sure I have seen a different mapping application which displays the code with considerably fewer clicks but I can’t remember where I saw it!

If I were interested in lots of stops, I would probably download the file
https://tfl.gov.uk/tfl/syndication/feeds/bus-sequences.csv
which is updated fairly regularly (and doesn’t change that much in any case).

There is a thread “Complete list of bus stops” about 20 threads down. You might find that worth a look.

I have just seen two new sets of files in the good old TfL Data Bucket for buses. There appears to be a pair of files for each day.

One set of files is of the form
https://bus.data.tfl.gov.uk/stops-sequences/Data_3rdParties_bus-stops-20240602.csv
and the other of the form
https://bus.data.tfl.gov.uk/stops-sequences/Data_3rdParties_bus-sequences-20240602.csv

The main difference is that one is just a list of stops while the other lists all the stops served each way in order for each route (thus the file is much bigger). The “4900…” code is present, also the SMS code and the code that typically appears on a metal plate on the underside of the stop flag. Also the stop name. The stops file includes one field not in the sequences file, namely the “stop area”, something which can be shared by a number of stops (I have no idea whether it bears any relationship to the “490G…” codes; I suspect not.)

I suspect that these are essentially the files already available through links such as that in my previous posting on this thread. While it is slightly interesting that they are now available in the Data Bucket, it is rather more interesting that a different pair of files is being created for each day, also where “3rd Parties” come into it.

A word of warning - if these csv files are opened in Excel they mess up some of the codes like 490001089E5 as 49000108900000, because Excel assumes the code is a number in scientific notation; it needs to be specified as text. From memory it only matters for a few stops in Croydon, Kingston and Sutton but it is still a pain.

Thanks @mjcarchive for picking this up. It seems TfL have reinstated the practice of regularly updating the two files - but uploading daily instead of the previous weekly.

This means I no longer need to create the CSV files from the XML timetables or the API JSON output so thanks also to the folk at TfL. slightly_smiling_face