derhuerst / vbb-rest

An HTTP API for Berlin & Brandenburg public transport.
https://v6.vbb.transport.rest/
ISC License
130 stars 12 forks source link

add custom IDs outside of the VBB service area #41

Closed HalukaMB closed 4 years ago

HalukaMB commented 4 years ago

Again, I want to stress how much this API has been a help.

However, I have come across the fact that for a bunch of cities from neighbouring federal states (Niedersachsen, Sachsen, Mecklenburg-Vorpommern, Sachsen-Anhalt), there is no callable ID for a station nearby. And hence, I was wondering, if there is a easy possibility to add these cities or whether this would go to the very core of the API. request_for_adding.xlsx

derhuerst commented 4 years ago

Again, I want to stress how much this API has been a help.

Thanks! If you can afford it, especially if you use this API in a professional context, consider supporting me via Patreon or via GitHub.

However, I have come across the fact that for a bunch of cities from neighbouring federal states (Niedersachsen, Sachsen, Mecklenburg-Vorpommern, Sachsen-Anhalt), there is no callable ID for a station nearby.

I'm trying to replicate what you were doing; Is it correct that the API doesn't return any stop nearby to the respective coordinates? E.g. nearby to latitude=50.7185&longitude=12.4956, it doesn't return any results (not even results without IDs).

And hence, I was wondering, if there is a easy possibility to add these cities or whether this would go to the very core of the API.

No, unfortunately not. vbb-rest is a REST API wrapper around vbb-hafas, which queries the underlying VBB HAFAS instance.

There's no clean way to "extend" the data set or functionality of HAFAS, because

So, as much as I'd like to support your legitimate use case, it is not really feasible that way. There is a more systematic approach however: building a network of federated data sources and/or APIs. With your use case, that would let use ask the respective local endpoints about IDs of e.g. Zwickau, and then do routing across the federated data sets.

This is a complex endeavour however, and AFAICT there's little existing work out there. Check the stable-public-transport-ids readme for the bigger picture, pan-european-public-transport for a work-in-progress implementation, and https://github.com/public-transport/ideas/issues/1 for a higher-level general chat about how to get data across Europe.

request_for_adding.xlsx

What is the AGS column in that file?

derhuerst commented 4 years ago

hafas-client, the library beneath vbb-hafas, already supports some HAFAS endpoints for neighbouring states of Brandenburg, and there's a tracking Issue for supporting more endpoints. You would have to do the work that pan-european-public-transport is supposed to do eventually (figuring out which endpoint(s) to use for a query), but that might be a feasible intermediate solution for you.

derhuerst commented 4 years ago

To keep an overview, I'm going to close this Issue because – as I explained above – a proper solution is far more complex than just hard-coding some IDs.

If you still have other questions about this problem, please just re-open.

HalukaMB commented 4 years ago

The AGS column is the Amtlicher Gemeindeschlüssel which is important to connect your API-data with national or regional stats. https://de.wikipedia.org/wiki/Amtlicher_Gemeindeschl%C3%BCssel