Api for bus stops in a radius


#1

What, Api do I use to find all the bus stops in a radius?


#2

Hi @adekunle77

This is probably the one you’re after:
https://api.tfl.gov.uk/swagger/ui/index.html?url=/swagger/docs/v1#!/StopPoint/StopPoint_GetByGeoPoint

Here’s an example of returning all bus stops within a 300m radius of the middle of St James’s Park
https://api.tfl.gov.uk/Stoppoint?lat=51.5025&lon=-0.1348&stoptypes=NaptanPublicBusCoachTram&radius=300

There’s some more context on this blog post https://blog.tfl.gov.uk/2015/10/08/unified-api-part-2-lot-location-of-things/

Hope that helps.


#3

Hi @JacobU Jacob,
First I would like to thank you for the quick response to my enquiry. I have tried to use that by I do not what enter in the following textfields;
Stoptype:
UseStopPoint:
Modes:
Categories:
ReturnLines:

Can you tell me what information I need to enter in those textfields. Cause every time I try get a 404 response?
Could you give a list of options that I put into each textfield please?


#4

I’ve had a quick check and I think the Swagger UI needs an update to build the API call correctly as it should just be returning “lat”/“lon” instead of “location.lat”/“location.lon” which looks to be causing the 404.

I’ll see if we can get that updated but in the meantime it might be easier to manually tweak the example I posted above to get it working for you. (https://api.tfl.gov.uk/Stoppoint?lat=51.5025&lon=-0.1348&stoptypes=NaptanPublicBusCoachTram&radius=300)

You should only need to enter the lat, lon, stoptype and radius to get a valid response - the rest is optional.

The stoptypes can be found here: https://api.tfl.gov.uk/StopPoint/meta/stoptypes - but as you mentioned you want bus stops, the one you want is NaptanPublicBusCoachTram .


#5

@JacobU Do I need to include my Application ID & Application Keys, with that url?


#6

Preferably yes - you should append your id and key to every request as per About the Unified API category