OpendataCH / Transport

Swiss public transport API
http://transport.opendata.ch/
MIT License
242 stars 50 forks source link

Walk time is 'null' in response, but is shown as a valid value on search.ch #206

Open swiss-knight opened 4 years ago

swiss-knight commented 4 years ago

Hi,

I have specially constructed a trip to check for large walks before reaching the very first public transport. I've noticed that the walk duration in the first section of this trip (which is only done by foot to reach the transportation stop) is shown as null with the Open Data Transport API:

http://transport.opendata.ch/v1/connections?from=Ch%C3%A2teau+d%27Oex%2C+Route+du+Mont+137&to=Vevey&via=&date=2020-06-22&time=07%3A00&isArrivalTime=0&limit=4&page=&direct=0&sleeper=0&couchette=0&bike=0&accessibility=

image

But that the exact same query, when executed directly on search.ch actually shows this walk duration:

https://timetable.search.ch/Ch%C3%A2teau-d%27Oex,Rte-du-Mont-137..Vevey?time=07.00&date=Mon+06%2F22%2F2020&toggle=v1

image

I also noticed that these 65 minutes correspond, indeed, to the difference between these two values in the Transport API response:
json_response['connections'][0]['sections'][0]['departure']['departureTimestamp']
and
json_response['connections'][0]['sections'][0]['arrival']['arrivalTimestamp']

Thanks for taking a look. Regards.

fabian commented 4 years ago

Interesting… would you be able to put together a pull request to calculate the walking time for this special case?

helbling commented 4 years ago

corresponding api call: http://fahrplan.search.ch/api/route.json?from=Ch%C3%A2teau-d%27Oex,%20Rte%20du%20Mont%20137&to=vevey

[..]
      "legs": [
        {
          "departure": "2020-04-27 10:08:00",
          "isaddress": true,
          "name": "Château-d'Oex, Rte du Mont 137",
          "type": "walk",
          "terminal": "Château-d'Oex",
          "runningtime": 3900,
          "exit": {
            "arrival": "2020-04-27 11:13:00",
            "stopid": "8501394",
            "x": 576404,
            "y": 147085,
            "name": "Château-d'Oex",
            "sbb_name": "Château-d'Oex",
            "waittime": 0
          },
          "type_name": "Fussweg"
        },
       [..]