juliuste / slovenske-zeleznice

Slovenske železnice (SŽ, Slovenian Railways) API client.
ISC License
11 stars 1 forks source link

Build GTFS data using this API #7

Closed sraka1 closed 5 years ago

sraka1 commented 5 years ago

Looking at https://github.com/juliuste/build-cp-gtfs, it seems like this package could be used to do the same for Slovenske Železnice. However, on https://github.com/public-transport/european-transport-operators it says that the unofficial SŽ API is GTFS incompatible. I haven't gone really in-depth, but what would be the reason - it seems all the data is there?

Also fyi, I made a freedom of information (FOI) request to data.gov.si, since SŽ is state-owned, and I'll make sure to add it to the european-transport-operators repo if they reply with something useful...

juliuste commented 5 years ago

First of all - thank you very much for your comment, as well as your FOI request, I'm eager to see what they'll reply.

Regarding your question wether or not it would be possible to build GTFS for SŽ using the API, I somewhat remember in the back of my head that something was weird about the endpoint and that it didn't behave like one would expect regarding different dates in the timetable. However, as you can see, I clearly don't really remember everything I learned back then, so I'll have another look at the API in the next few days and will see what is possible 🙂

juliuste commented 5 years ago

Update: I had a look at the API again, the problem is that there is no endpoint to find departures or arrivals for a given station, like there is for the portugese CP API used in build-cp-gtfs, for example. We would need this to find all trains on a given date.

Please re-open if you have any further questions 🙂

sraka1 commented 5 years ago

@juliuste that seems to be true, but one can do the reverse route. On the SŽ network, the train identifier is a 1-4 digit number in the range 0-39999. Using Postaje_vlaka_vse (roughly translated - Stations_of_train_all) and looping through the entire range, it should be possible to retrieve all the trains for a given date. However, the folks at SŽ might not like such an amount of requests (some sort of client-side rate limiting would need to be integrated, I don't think they have anything on the server). Thoughts?