Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coordinate to Coordinate routing for HAFAS #40

Open
1Maxnet1 opened this issue Mar 7, 2024 · 5 comments
Open

Coordinate to Coordinate routing for HAFAS #40

1Maxnet1 opened this issue Mar 7, 2024 · 5 comments

Comments

@1Maxnet1
Copy link
Contributor

1Maxnet1 commented Mar 7, 2024

Do you know whether it is possible to have a routing request from one coordinate to another? So instead of providing start and destination as a station, providing a geo-point?

@sn0opy
Copy link
Contributor

sn0opy commented Apr 5, 2024

You could have a look at #42. It should makes things easier to calculate a journey between two geo points.

@1Maxnet1
Copy link
Contributor Author

You could have a look at #42. It should makes things easier to calculate a journey between two geo points.

Thanks a lot! However this seems not to be suiting my use-case. The aim would be to compare HAFAS to e.g. a MOTIS or OTP Server. And they can do intermodal routing (aka having two Geo-Points and let the server decide to which stop I should go or even drive by bike). The nearby request can be used to implement this "by hand" but would require a lot of post-processing. So the questions arises if the HFAS servers can already to that natively (which would allow for a fair comparison).

Nevertheless I really appreciate your contribution :)

@sn0opy
Copy link
Contributor

sn0opy commented Apr 18, 2024

I was looking into it a bit deeper, since the frontends provide a button to locate the closest station via GPS (or any alternative, that provides latitude and longitude). It looks like you always have to do some sort for request inbetween. The standard frontends seem to use the LocMatch request for that, which is already implemented via locations() but requires some slight updates for x/y coordinates to work

@1Maxnet1
Copy link
Contributor Author

I was looking into it a bit deeper, since the frontends provide a button to locate the closest station via GPS (or any alternative, that provides latitude and longitude). It looks like you always have to do some sort for request inbetween. The standard frontends seem to use the LocMatch request for that, which is already implemented via locations() but requires some slight updates for x/y coordinates to work

Thanks for the ideas, I chatted with @derhuerst , who claims that there is also a support for requests including GeoPoints (maybe not for all instances though). When I find some time, I will double check the implementation of https://invent.kde.org/libraries/kpublictransport and whether they support it. Then we might get the required info to implement it for pyhafas as well.

@derhuerst
Copy link

In hafas-client, the equivalent implementation is here:

https://github.com/public-transport/hafas-client/blob/6.3.0/index.js#L116-L117
https://github.com/public-transport/hafas-client/blob/6.3.0/format/location.js#L12-L14
https://github.com/public-transport/hafas-client/blob/6.3.0/format/address.js#L9-L22

Years ago, when I implemented this, it seemed like HAFAS expects an address (O parameter) – which I'd assume they usually expect to be a street name –, but AFAIR you can put anything in there, as long as the field is present, because the coordinates are the key pieces of information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants