Finding the travel time between two stations

Hi I’m an a level student and I’m making a project about finding the shortest route on the London Underground and I’m creating this in python.

I really don’t know how to use API’s and I’m wondering if someone could help me in finding the travel time between two stations?. Thank you.

Welcome @Ja123

Are you using Dijkstra's algorithm - Wikipedia ?

You can grab everything you want with a couple of calls to 22 calls… _______ is the line and $$$$$$ is the direction…

    const strTestURL = "https://api.tfl.gov.uk/line/_______/Route/Sequence/$$$$$?";
    const arrTubeLineTranslate = [
    "bakerloo" => "B",
    "central" => "C",
    "circle" => "H",
    "district" => "D",
    "hammersmith-city" => "H",
    "jubilee" => "J",
    "metropolitan" => "M",
    "northern" => "N",
    "piccadilly" => "P",
    "victoria" => "V",
    "waterloo-city" => "W"
];
     const INBOUND = "inbound";
     const OUTBOUND = "outbound";

And a bit of Calculating distance between two geo-locations in Python | by Ashutosh Bhardwaj | Towards Data Science

2 Likes

I’m going to be using the A* Algorithm. After doing a bit of actual research into it I’ve managed to do everything I’d like but I appreciate your response thanks.

That final link is actually very useful for me thank you.

1 Like