[GraphHopper] Detecting the orientation of an edge against the orientation of the way in OSM

Bruno Carle brunocarle at yahoo.com
Wed Jun 11 13:58:19 UTC 2014


Hi,
I have some code to override the edge's weight depending on the orientation of the way in OSM. Please could you tell me if the snippet below is correctly detecting the orientation of the edge against the orientation of the way in OSM? My doubt is mainly for the first statement reverseEdge=...

public double calcWeight( EdgeIteratorState edge, boolean reverse )  {
    ...
    // is the edge in the same direction as way in OSM

    boolean reverseEdge=edgeIteratorState.getBaseNode() <edgeIteratorState.getAdjNode();
    ... 

    // compare reverseEdge and reverse to figure out if we are navigating the edge forward 

    // or backward according to way in OSM
    boolean reverseNavigation=reverseEdge!=reverse;
    ...

Thanks!
Bruno     



More information about the GraphHopper mailing list