graphhopper / graphhopper

Open source routing engine for OpenStreetMap. Use it as Java library or standalone web server.
https://www.graphhopper.com/open-source/
Apache License 2.0
5.27k stars 1.59k forks source link

Distance of single edge restricted #435

Open karussell opened 9 years ago

karussell commented 9 years ago

As the distance for every edge can be roughly max 1000km we have two OSM way where this is exceeded (ferries!) and we need to deal with this:

The problem is that we currently return Double.Infinity if Integer.max is reached but math operations with infinity can lead to NaN which makes nearly every operation with them invalid.

A quick workaround would be to use all 32 bits instead of only the positive range of int as it is currently done.

zhiqiangZHAO commented 9 years ago

Since there are so rare, may be break them in osm?

dos65 commented 9 years ago

Also, there is possible to split them on reading process

karussell commented 9 years ago

Yeah, good idea to split the edges in the import process.

zhiqiangZHAO commented 9 years ago

hah, I am so lazy.

karussell commented 9 years ago

Hmmh, such ferries should be normally tagged as route relationes i.e. the way should be splitted in OSM itself I think. As the wiki says: "The relation approach [...] is useful for very long ferry routes. The relation approach is standard across other types of transportation routes."

karussell commented 9 years ago

Removing the bug label, as this is more an OSM issue. Still we need to think about if we should return a very large distance instead of infinity.

karussell commented 8 years ago

I included a workaround for this (no way splitting for now) as the work to do this splitting properly is not worth the effort (at least not at the current time). But at the same time it is critical to throw an exception in setDistance if the distance is too large.

karussell commented 8 years ago

The problem is now that for CH preparation we set the distance and it can easily grow over int max for some shortcuts when processing world wide data.

As a workaround we should just return max int. In the future we have to decide if we remove the distance data from the CH graph (then certain applications would slow down) or how we fix this properly. Maybe we should make the multiplication factor smaller?

easbar commented 5 years ago

I think we should reduce the distance from currently mm to 0.1m.