Skip to content

Speed is 0 for low speed edges #1234

Closed as not planned
Closed as not planned

Description

@boldtrn

If you use the motorcycle profile and the curvature weighting and read an OSM way with a low maxspeed, for example maxspeed=2, the speed of the edge will be 0. An example way can be found here.

java.lang.IllegalStateException: Calculating time should not require to read speed from edge in wrong direction. Reverse:false, fwd:false, bwd:false
	at com.graphhopper.routing.weighting.AbstractWeighting.calcMillis(AbstractWeighting.java:44)
	at com.graphhopper.routing.weighting.FastestWeighting.calcMillis(FastestWeighting.java:83)
	at com.graphhopper.routing.Path.processEdge(Path.java:242)

Activity

  1. karussell commented on Dec 4, 2017

    @karussell
    Member

    When I think about this a bit more: this is kind of expected as we set access to false for speed==0 and so if speed is rounded downwards the result can be access==false. The only other solution would be a different rounding strategy if close to 0. But having speed==0 and access==true does not make sense.

  2. karussell commented on Dec 4, 2017

    @karussell
    Member

    But the question is why there is a path going through if access==false for both directions.

  3. boldtrn commented on Dec 4, 2017

    @boldtrn
    MemberAuthor

    But the question is why there is a path going through if access==false for both directions.

    I think I found the issue here. The CurvatureWeighting has no clause if(speed==0) return Double.POSITIVE_INFINITIVE.

  4. karussell commented on Sep 10, 2018

    @karussell
    Member

    This is a more general problem that we always had problems with.

    For motorcycle we could solve it consistent: we could make the access-check dependent on speed==0 and do not use separate access bits as we have one speed value for every direction.

    But for other vehicles like car or foot we only want to use speedBits+2 instead speedBits*2 and so we need two separate access bits.

    In the latest branch #1447 we could try to solve this via creating a special "combined" speed+access EncodedValue that handles this on the lowest level and switches to speedBits*2 without any access bits if the speed value should be stored for both directions.

    update: I've tried to implement this combined EncodedValue and it is a very tricky thing. The only consistent solution is to forbid setting access flags explicitly in both cases and influence access only via setting speed to 0. But then we would solve this problem only for fastest weighting. What if there is a more complicated weighting (v/s+time_offset) or just shortest where we need separate access values as we cannot change the distance to 0. Maybe an EdgeFilter using the Weighting similar to #729 would help.

  5. changed the title [-]Speed is 0 for low speed edges using motorcycle[/-] [+]Speed is 0 for low speed edges[/+] on Sep 10, 2018
  6. karussell commented on Mar 27, 2023

    @karussell
    Member

    This can still happen but only if the speed is extremely small. Closing for now as it can be avoided if the code is moved into a custom model and then the value does not have to be stored in an encoded value.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions