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

graphhopper graphhopper at gmx.de
Thu Jun 12 12:05:02 UTC 2014


I would use two arrays which you access via the edge id to get your
properties. And depending on baseNode < adjNode or opposite you know
which array to use.

Coordinates are another solution but possible error prone and slower.

Regards,
Peter.

> Our overrides rely on the orientation of the way in osm. They can be
> oriented (e.g. when a user wants to avoid using a road in one
> direction, but in the other direction it is ok )
>
> If the nodeIdx can not be used, then I will use the coordinates.
>
> Thanks
> Bruno
>
>
> On Thu, Jun 12, 2014 at 11:39 AM, graphhopper <graphhopper at gmx.de
> <mailto:graphhopper at gmx.de>> wrote:
>
>     Hey Bruno,
>
>     in a version before 0.3 it was hard to find out the orientation of
>     *an edge* as for bidirectional algorithms there is a forward and
>     backward search going on. Maybe a solution via your "baseNode <
>     adjNode" check is the only one.
>
>     *But* now that I better understand your use case ... to find out
>     how the original *OSM way* (not the edge) is oriented is
>     impossible as we "forget" this information while import. What do
>     you want to achieve with this or what information relies on the
>     original OSM way orientation?
>
>     Regards,
>     Peter.
>
>
>>     Hi,
>>     The reverseNavigation flag is meant to tell me if the edge passed
>>     as parameter
>>     will be used in the path returned by route() in the same
>>     direction as the edge's way in the OSM file, or in the reverse
>>     direction.
>>
>>     I use this information in order to apply the overrides that we
>>     implemented at Rinkai.
>>
>>     From what I understood in yesterday's discussion, in the current
>>     release there is already such a flag beeing passed to the
>>     weighting function, but I am using a cloned repository which was
>>     last merged march 17.
>>
>>     Thanks
>>     Bruno
>>
>>
>>
>>     ----- Forwarded Message -----
>>     Sent: Wednesday, June 11, 2014 4:27 PM
>>     Subject: Re: Detecting the orientation of an edge against the
>>     orientation of the way in OSM
>>
>>     Hey Bruno,
>>
>>     looks like my mail in yahoo.de <http://yahoo.de> does not like
>>     message from your yahoo.com <http://yahoo.com>
>>     ;) hope they'll resolve this somehow. (for now keep me in CC)
>>
>>     What do you want to achieve with reverseNavigation?
>>
>>     The reverse variable is necessary if the backward search is going
>>     on -
>>     e.g. you need to call edge.getReverseSpeed. So I guess you just need
>>     reverseNavigation=reverse but not sure ...
>>
>>     Regards,
>>     Peter.
>>
>>
>>
>>
>>     > 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   
>>     >
>>
>>
>>     --
>>     GraphHopper.com - Fast & Flexible Road Routing
>>
>>
>>     _______________________________________________
>>     GraphHopper mailing list
>>     GraphHopper at openstreetmap.org <mailto:GraphHopper at openstreetmap.org>
>>     https://lists.openstreetmap.org/listinfo/graphhopper
>
>
>     _______________________________________________
>     GraphHopper mailing list
>     GraphHopper at openstreetmap.org <mailto:GraphHopper at openstreetmap.org>
>     https://lists.openstreetmap.org/listinfo/graphhopper
>
>
>
>
> _______________________________________________
> GraphHopper mailing list
> GraphHopper at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/graphhopper

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20140612/f2a7e26a/attachment.html>


More information about the GraphHopper mailing list