I’m looking for a list of station lat/longs. There seems to be a reference to this on TfL’s list of available APIs under ‘station locations’ but I cannot seem to find this data within the API portal itself. I’m just looking for the station name and a singular lat/long for that station, and if anyone could point me in the direction of where I’d be able to obtain this I’d be very grateful.
@LeonByford
It would be useful to use that method to get all bus stop locations with lat/lon so I tried https://api.tfl.gov.uk/StopPoint/Mode/bus. That gives the error: “Bus mode must be paginated as data set is too large.”
Can the entire set be downloaded directly (without using a browser) or is pagination an essential API option for that as well? If so how to implement it?
The lat/lons are in there, but please note that the StopPoint data is a hierarchy rather than a flat array. You may need to use the children property of a StopPoint to work your way down to a StopPoint that does contain lat/lons.
@LeonByford (or anyone)
Following your recent suggestion I have been investigating the set of bus StopPoint JSONs returned by the API. There is one really useful field (not in the NaPTAN downloads) that I would like to add to my existing database - the locations shown on each bus stop to indicate the direction of travel.
If there is an API call to return just that field plus the corresponding NaPTAN ATCO for each relevant bus stop it would be vastly preferable to attempting to extract it from 37 large JSON files. The JSON data location is:
category, key, sourceSystemKey, value
Direction, Towards, CountDown, [eg Hinchley Wood]
I would still be interested to hear whether the API call I requested exists but it was easier than I thought to extract fields from the set of 37 .json pages. “Towards” and “lines” (bus routes served) are really useful StopPoint data but I have not found them in any publicly available .csv/.xlsx downloads.
@briantist I have been using those zips for several months, primarily to maintain an up-to-date database of route sequences. A list of routes calling at each stop could be extracted with some code but if the “Towards” data is there it has eluded me. The values are the localities displayed as directional guidance at bus stops, not necessarily the bus destinations. For example, in post #10 I mentioned Hinchley Wood which is not a destination of the bus (K3) serving the stops with that value.
Just looking at my code that decodes those files, I seeing the code look for “DynamicDestinationDisplay” which only appears in the TfL data (not the UK-wide data).
@briantist "Oxford Circus, Trafalgar Square or Victoria” is factually correct in that there are buses from Stop A heading towards those destinations but apparently it is not what is printed on the stop:
72626 490004722A St Pancras International Stop A 235 W 29-31 Euston Road St Pancras London London WC1H 8NP Tottenham Court Road; Russell Square Or Baker St n73;n91;n205;390;73;91;205;30
If anyone reading this thread happens by St Pancras International in the next few days perhaps they could take a photo of Stop A for us.