dbopendata / db-fahrplan-api

DB Fahrplan API
31 stars 1 forks source link

add connection search from station to station #21

Open maltegoetz opened 8 years ago

maltegoetz commented 8 years ago

For a lot of applications it would be really useful to be able to pull a list of connections between two stations. At the moment a lot of applications just simulate calls from the DB mobile apps which is sophisticated and does not fit to the openData initiative.

highsource commented 8 years ago

Noted.

At the moment the best choices are Public Transport Enabler or rolling your own with GTFS.

reghrafa commented 8 years ago

That would be pretty neat!

J0ANMM commented 8 years ago

This would be definitely a very useful feature!

Until this is available, I've created something in Python that seems to work: https://github.com/J0ANMM/db-legs

Feel free to contribute in order to improve it and optimize it! :) Also, as this requires a big amount of requests to the DB API, it would be interesting to have also DB's point of view to make sure it does not overload the servers or something like that.

highsource commented 8 years ago

@J0ANMM Why don't you just take GTFS? That was already created by @fredlockheed: https://github.com/fredlockheed/db-fv-gtfs

You won't need to make any API accesses then.

J0ANMM commented 8 years ago

I had a look at it, but what I understood is that it takes 2 days to get everything and it is somehow fixed data. I was looking for something more dynamic, that it can be updated as soon as new data is available. In addition, there could be the case that only some of the stations are of interest. In that case, modifying slightly the code could give a mean to obtain the relevant data in a fastest way.

Did I misunderstand how GTFS works?

highsource commented 8 years ago

@J0ANMM The data is there: https://github.com/fredlockheed/db-fv-gtfs/files/201511/2016.0.1.zip Just download.

Next, DB Fahrplan API only offers planned data ("SOLL-Fahrplan"). I don't think there will be "new" data available anyway.

J0ANMM commented 8 years ago

Very interesting indeed. Then I can adapt it to retrieve the data from there when creating the legs.

Thanks for the feedback!

J0ANMM commented 8 years ago

Code has been updated to get all the data from GTFS: https://github.com/J0ANMM/db-legs

Feel free to have a look.

It takes around 10min to create the table with all possible upcoming legs. As of today with the latest release, that is >10,000,000 rows. Then it takes less than one minute to get all legs between two stations for a specific date in JSON format.

SimWoh commented 6 years ago

Hey guys! Since there is a new DB-API (http://api.deutschebahn.com/fahrplan-plus/v1) your great solutions to find the connections between cities aren't working for me anymore. Do you have a quick fix solution to find the connections between stations in a specific time by using this API ?