Is there a way to “avoid” say Elizabeth line while looking for journey option - i.e. similar to what one is able to do in the tfl website?
Hello. Yes, this is entirely possible. In fact, Journey Planner on the TfL website uses the Unified API, so anything you can do on the website is possible through the API.
mode argument allows you to select which modes you want to use. So if you want to use bus and DLR, you can do
You can get a list of all supported modes from:
Here’s a comma-separated list of the mode IDs we have at the moment:
Therefore, if you want to avoid the Elizabeth line, you can specify every mode other than the Elizabeth line.
So, to put it all together, if I want to plan a journey from Abbey Wood to Liverpool Street, using all modes except the Elizabeth line, I can make a request to:
This is what the website does in the background when you filter out a mode.
I hope this helps. Let me know if you have any further questions.
Perfect - so one needs to provide “all modes except” the one you want to exclude? Given that it might be sometimes useful to have a “disallowed” list, would you consider the ability to supply “all except ” as a feature for your backlog?
Thank you for your suggestion – I can certainly see why it would be useful. I’ll keep it in mind.
Hi Leon - the response body to the above request does bring back “Elizabeth Line” options - is that to be expected (or) is it a bug?
Apologies, I originally made a typo in my example request URL – I forgot to include
I edited my post to fix this, and it should work properly now. Please let me know if there’s still an issue.
Gives the expected result - Thank You
I think there are other journey characteristics that should be “avoidable” in that manner – specific stations, specific lines of the tube, maybe even any sections of tube and NR that measurements and user complaints show to have unreasonably excessive noise levels.
Particularly annoying is that “travel via” gives journeys that don’t stop at the specified station, which is no help if the requirement is to break the journey at that station (eg because the start and end points don’t have toilets).
Above all, one of the most important is the ability to exclude journeys that cannot be performed with a freedom pass – an essential requirement to prevent unnecessary and possibly unlawful discrimination against an important minority of Londoners that that your predecessors have recklessly and irresponsibly ignored despite requests in this forum for at least 5 and probably 8 years.
I’ve got the data…
Many thanks for your feedback, which I will take on board. There are several initiatives we are working to address some of those things, such as the alternative routes functionality my colleague announced recently.
Being able to specify an interchange station is an interesting idea, which we explored today. There are some situations we would need to consider, such as what would happen if there is no reasonable journey that interchanges at that station, or what would happen if you specified a station that is on the direct route.
Your suggestion of the ability to only return journeys that can be taken with a Freedom Pass is a good one. Looking through the archives, I see that this was worked on extensively in 2007, and was revisited in 2015 and 2016. It seems like there were significant challenges to making such a feature available, which is why it wasn’t released. I can’t promise anything, but I am trying to see if there is any way we can provide this functionality.