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

Bruno Carle brunocarle at yahoo.com
Tue Jun 10 14:59:15 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20140610/2d5cbfd6/attachment.html>


More information about the GraphHopper mailing list