juliuste / direkt.bahn.guru

All direct long-distance railway connections for cities in and beyond central Europe.
https://direkt.bahn.guru
GNU General Public License v3.0
368 stars 24 forks source link

[Suggestion] add an option to allow 1 connection #14

Open Andrea-FEVE opened 2 years ago

Andrea-FEVE commented 2 years ago

Only 1 connection offers so many more possibilities for travelling, with little inconvenience. I would love to see where I wan travel with only 1 change.

juliuste commented 2 years ago

Thanks for the suggestion, I would really like this as well! Unfortunately, it seems borderline impossible to implement such a feature with the current data source the app is using, see also this gist.

I will however keep this in mind for the future, and if anyone else has an idea how to implement this with the current API, please let me know 🙂

pitrade commented 2 years ago

This Feature would be very interesting because of the upcoming 9€-Ticket. Long travel durations are outweighed by higher price differences between local and long distance trains. An heuristic to implement this could be to run the api call again for each station in the result of the origin. Then delete every station in the secondary results which occurs in first one. Add up both durations plus an estimation of 30 Minutes for the change. Combine the results but only the lowest duration for each station. To improve the performance you could extend the current api by the number of adjacent stations. There is no need to call the api again for a station in the result if this value is 2 or lower.

astroleo commented 2 years ago

How difficult would it be to store the entire connection list in a local database (to be updated every once in a while of course)? There are 5700 stations in Germany, perhaps 50,000 in Europe? Each of them has direct connections to perhaps 100 places on average? If you stored these 5 million possible direct journeys, you could easily answer the question how many places are reachable within 1 (or any number of) changes, too. The total travel time wouldn't be accurately known, however, because the connection information is lost this way, but perhaps, for long-distance journeys, that isn't that relevant?

juliuste commented 2 years ago

This doesn't work with the current data source, unfortunately, because it would require too many requests (as far as I can tell). One would need a static dataset/dump for that, and unfortunately there is no such thing at the moment - at least AFAIK.

astroleo commented 2 years ago

Thanks. Can you say how many requests are allowed (per time)? Perhaps this information could be crowdsourced by running a script on multiple computers…?

pitrade commented 2 years ago

How about this easier solution: When you click on a directly reachable station, that station becomes the new origin. Only one request per click ist needed but unlimited changes are possible then.

xeruf commented 1 year ago

yes, that last suggestion is also what I expected, maybe the extra features can be made available on hover and/or right-click

tuukka commented 1 year ago

This would be important also for knowing if a faster trip but with a transfer exists in addition to the direct trip. (As a special case, you'd be able to answer this question for two stations with two queries: try to join all the departing trains of the origin station with all the arriving trains of the destination station.)

Idea: You wouldn't need to fetch the data for all the stations in Europe: you can pick a (hopefully small) set of stations that cover all the trains in Europe. You couldn't fetch these once per user, but maybe once per day? (Do you already store all the results that are fetched?)