Skip to content

OSM data sometimes contains zero weight loops #1355

Closed

Description

@easbar

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.

Activity

  1. karussell commented on May 3, 2018

    @karussell
    Member

    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.

  2. boldtrn commented on May 3, 2018

    @boldtrn
    Member

    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)?

  3. easbar commented on May 3, 2018

    @easbar
    MemberAuthor

    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).

  4. karussell commented on May 4, 2018

    @karussell
    Member

    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?

  5. boldtrn commented on May 4, 2018

    @boldtrn
    Member

    What was again the problem with weight==0 for CH @boldtrn?

    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.

  6. karussell commented on May 4, 2018

    @karussell
    Member

    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)

  7. easbar commented on May 4, 2018

    @easbar
    MemberAuthor

    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)

  8. karussell commented on May 4, 2018

    @karussell
    Member

    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)

  9. easbar commented on May 4, 2018

    @easbar
    MemberAuthor

    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.

  10. karussell commented on May 4, 2018

    @karussell
    Member

    We could also artificially set the distance to a small value in case of these barriers (like an elevation difference)

  11. karussell commented on Sep 10, 2018

    @karussell
    Member

    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.

  12. easbar commented on Apr 1, 2019

    @easbar
    MemberAuthor

    Edge-based CH was adjusted to handle zero weight loops and OSM import prevents loop edges: #1531. Closing for now.

  13. added this to the 0.12 milestone on Apr 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions