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

Wrong driving time across countries with different speed limits #957

Closed
dcdieci opened this issue Mar 18, 2014 · 9 comments
Closed

Wrong driving time across countries with different speed limits #957

dcdieci opened this issue Mar 18, 2014 · 9 comments

Comments

@dcdieci
Copy link

dcdieci commented Mar 18, 2014

Hi,

I just prepared new data for an "inter-country" routing between germany and switzerland. Point being is that both countries have different speed limits. So I need to provide two different profiles for data preparation which I did not figure out how to do it.

Please don't bother about creating this ticket as an issue. I am not sure whether it is a feature request but imho the calculated routes are wrong due to this constraint. I would be very happy to hear back from you guys.

Best,
Philip

@DennisOSRM
Copy link
Collaborator

Please elaborate on what you think is wrong. Perhaps with a couple of examples.

@dcdieci
Copy link
Author

dcdieci commented Mar 18, 2014

I prepared all the data with a speed limit for highways of 120 km/h. This is totally fine for a route from Basel to Bern within Switzerland. But as soon as I choose an origin in germany (e.g. Karlsruhe to Basel) I do get wrong driving times, since I am allowed to drive much faster. A speed limit of 130 km/h would be much more appropriate for the part of the route which is in germany. But I don't see the option to prepare data for different countries with distinct speed limits ?!

@emiltin
Copy link
Contributor

emiltin commented Mar 18, 2014

See #333. The way you could do it, is to call Postgis from the lua profile for each way, to determine which country it's located it. The downsize is preprocesssing will be slower.

@emiltin
Copy link
Contributor

emiltin commented Mar 18, 2014

The blog post The blog post https://www.mapbox.com/blog/osrm-using-external-data/ has as example of querying Postgis from the LUA script.

@dcdieci
Copy link
Author

dcdieci commented Mar 18, 2014

"See #333. The way you could do it, is to call Postgis from the lua profile for each way, to determine which country it's located it. The downsize is preprocesssing will be slower."

But what about a route between two countries?

Imagine a route from A to C via B. B is the border (but I dont know the geo location of the border, since i don't know which route will be the fastest ). So this would mean i need to have a speed limit of 130 kmh for A to B and a speed limit of 120 kmh from B to C.

@emiltin
Copy link
Contributor

emiltin commented Mar 18, 2014

I think perhaps you misunderstand how it would be done - you set different max speed for each individual way segment during preprocessing, depending on what country they're located in; some would get 120, others 130 - quite similar to how various tags normally influence the speed of ways. During routing, Postgis would not be accessed.

I believe each way is split into individual segments at nodes before processing (true Dennis?), so usually you wouldn't have long segments straddling a border. But if you really wanted to avoid this (I don't think it would be worth it), you could preprocess OSM data to insert nodes wherever a way crosses a border, or do more complicated maxspeed computations in LUA for segments straddling a border.

@dcdieci
Copy link
Author

dcdieci commented Mar 19, 2014

i get your point, but this sounds like a lot more pre processing time which will be needed ?!

@emiltin
Copy link
Contributor

emiltin commented Mar 19, 2014

The way osrm works is that everything is precomputed, so route queries are fast.
Yes, accessing Postgis will make preprocessing slower, but probably not as bad as one might imagine, and queries by users will be as fast as usual. My experience with coding the example in https://www.mapbox.com/blog/osrm-using-external-data/ was that the slowdown in processing was not too bad.
It's possible that it would be faster to precompute spatial relations using Postgis before processing by osrm. In your example you could use a SQL query to determine what country each way belongs to, and store that in a separate sql column, so it's ready for fetching from lua.

@TheMarex
Copy link
Member

@dcdieci we allow for country specific maxspeed tags. Tagging a motorway inside switzerland with maxspeed=ch:motorway will do the right thing.

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

4 participants