You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OSM data sometimes contains zero weight loops #1355
OSM sometimes contains loop edges with zero distance leading to warnings like this:
`Setting weights smaller than 0.001 is not allowed in CHGraphImpl#setWeight. You passed: 0.0 for the edge 10723709 from 51.439458536493596,7.000066310168795 to 51.439458536493596,7.000066310168795`
For edge-based CH #1247 this can be problematic and since these edges have no real meaning for routing (?) the best option might be to remove them during the graph import.
Yes, for OSM 'bugs' removing is an option but still you can have Weightings that somehow make this 'mistake'. So it is also related to the fact that we should use a list of Weightings where possible instead of a list of FlagEncoders. E.g. for subnetwork removal and things like LocationIndex #729.
Wouldn't it be better to set the minWeight in this case? Sometimes these are not just loops but very very small ways (maybe 10cm or less long), but they connect two ways. If it's a loop and weight!=0 would this be an issue for routing?
If it's a loop, like the one shown in comment, this would probably best be fixed in OSM (if there are not too many and if they are clearly bugs)?
but still you can have Weightings that somehow make this 'mistake'
Ok, but this does not make any sense, right ? It never makes sense for a route to take a loop with zero weight, so I would consider a weighting that produces zero weight for a loop to be ill-defined (unless of course the distance is also zero, which should never be either and which is why I created this issue).
So it is also related to the fact that we should use a list of Weightings where possible instead of a list of FlagEncoders
Hmm, not sure what you mean here ? Is this related to the ongoing encoder refactoring ?
Wouldn't it be better to set the minWeight in this case? Sometimes these are not just loops but very very small ways (maybe 10cm or less long), but they connect two ways. If it's a loop and weight!=0 would this be an issue for routing?
Loops with weight > 0 are of no concern and rather common I guess. Setting minWeight on the zero distance loops from OSM would be a possible solution for the issue I am having with turn-cost CH.
If it's a loop, like the one shown in comment, this would probably best be fixed in OSM (if there are not too many and if they are clearly bugs)?
I got warnings for about 10 such cases in Germany, so these are very rare. Fixing the OSM data would of course be the best solution, but I think it comes down to the question whether or not it is acceptable for us that the routing might produce a wrong result when the zero distance loops are not fixed (which will always happen occasionally).
So it is also related to the fact that we should use a list of Weightings where possible instead of a list of FlagEncoders
Hmm, not sure what you mean here ? Is this related to the ongoing encoder refactoring ?
Kind of, yes. I meant the fact that we currently use FlagEncoder everywhere where the Weighting would make more sense, as different Weightings could apply different accessibility.
Ok, but this does not make any sense, right ?
What was again the problem with weight==0 for CH @boldtrn? A zero weight should be ok for Dijkstra as it would be just 'a neutral hop'? The only problem I found was that through rounding errors a value>0 could end up as value==0. But still then the question is: what is the problem with that?
I remember an issue with VirtualEdges and Instructions
Maybe there could be a better fix than this workaround and we could even allow this? The problem is that if there is an edge with the minimal weight, then a query point in the middle can always cause the weight of the virtual edge being 0 (e.g. very close to junction and rounding issues)
A zero weight should be ok for Dijkstra as it would be just 'a neutral hop'? The only problem I found was that through rounding errors a value>0 could end up as value==0. But still then the question is: what is the problem with that?
Yes I think normal Dijkstra handles this without a problem except that the route can randomly include or exclude the neutral loop. The problem I am having is very specific to the contraction in edge-based CH, e.g. here (note that this assumes even two zero distance loops at the same node)
When we completely forbid this, then we would make current workarounds like this impossible (barriers via zero length edges)
The problem in your case might be that t=s/v and if v==0 we get t=infinity and all is fine (as this is usually handled in the Weighting), but if 0/0 this will lead to NaN, see #432 (comment)
Ah ok, I did not know about this workaround and was hoping we can simply exclude the zero distance loops. I will see if I can come up with another solution and we can see if this is still an issue when turn cost enabled CH gets merged.
I was wrong regarding the barriers: they are implemented as zero-distance edges but we block access for all vehicles. So they should not make an issue here if access is tested via EdgeFilter.
Activity
karussell commentedon May 3, 2018
Yes, for OSM 'bugs' removing is an option but still you can have Weightings that somehow make this 'mistake'. So it is also related to the fact that we should use a list of Weightings where possible instead of a list of FlagEncoders. E.g. for subnetwork removal and things like LocationIndex #729.
boldtrn commentedon May 3, 2018
Wouldn't it be better to set the
minWeightin this case? Sometimes these are not just loops but very very small ways (maybe 10cm or less long), but they connect two ways. If it's a loop andweight!=0would this be an issue for routing?If it's a loop, like the one shown in comment, this would probably best be fixed in OSM (if there are not too many and if they are clearly bugs)?
easbar commentedon May 3, 2018
Ok, but this does not make any sense, right ? It never makes sense for a route to take a loop with zero weight, so I would consider a weighting that produces zero weight for a loop to be ill-defined (unless of course the distance is also zero, which should never be either and which is why I created this issue).
Hmm, not sure what you mean here ? Is this related to the ongoing encoder refactoring ?
Loops with weight > 0 are of no concern and rather common I guess. Setting minWeight on the zero distance loops from OSM would be a possible solution for the issue I am having with turn-cost CH.
I got warnings for about 10 such cases in Germany, so these are very rare. Fixing the OSM data would of course be the best solution, but I think it comes down to the question whether or not it is acceptable for us that the routing might produce a wrong result when the zero distance loops are not fixed (which will always happen occasionally).
karussell commentedon May 4, 2018
Kind of, yes. I meant the fact that we currently use FlagEncoder everywhere where the Weighting would make more sense, as different Weightings could apply different accessibility.
What was again the problem with weight==0 for CH @boldtrn? A zero weight should be ok for Dijkstra as it would be just 'a neutral hop'? The only problem I found was that through rounding errors a value>0 could end up as value==0. But still then the question is: what is the problem with that?
boldtrn commentedon May 4, 2018
This is related to #1032 and #1013.
I have seen very odd results with weight=0 and CH. I remember an issue with VirtualEdges and Instructions.
karussell commentedon May 4, 2018
Maybe there could be a better fix than this workaround and we could even allow this? The problem is that if there is an edge with the minimal weight, then a query point in the middle can always cause the weight of the virtual edge being 0 (e.g. very close to junction and rounding issues)
easbar commentedon May 4, 2018
Yes I think normal Dijkstra handles this without a problem except that the route can randomly include or exclude the neutral loop. The problem I am having is very specific to the contraction in edge-based CH, e.g. here (note that this assumes even two zero distance loops at the same node)
karussell commentedon May 4, 2018
Understood.
When we completely forbid this, then we would make current workarounds like this impossible (barriers via zero length edges)
The problem in your case might be that t=s/v and if v==0 we get t=infinity and all is fine (as this is usually handled in the Weighting), but if 0/0 this will lead to NaN, see #432 (comment)
easbar commentedon May 4, 2018
Ah ok, I did not know about this workaround and was hoping we can simply exclude the zero distance loops. I will see if I can come up with another solution and we can see if this is still an issue when turn cost enabled CH gets merged.
karussell commentedon May 4, 2018
We could also artificially set the distance to a small value in case of these barriers (like an elevation difference)
karussell commentedon Sep 10, 2018
I was wrong regarding the barriers: they are implemented as zero-distance edges but we block access for all vehicles. So they should not make an issue here if access is tested via EdgeFilter.
Ignores tests failing for zero weight loops, see graphhopper#1355.
easbar commentedon Apr 1, 2019
Edge-based CH was adjusted to handle zero weight loops and OSM import prevents loop edges: #1531. Closing for now.