navitproject.org http://forum.navitproject.org/ 

Route path  which node is a junctions http://forum.navitproject.org/viewtopic.php?f=13&t=414 
Page 1 of 1 
Author:  Lusipa [ 26 Jun 2013, 08:25 ] 
Post subject:  Route path  which node is a junctions 
based on the topic "route path coordinates" i want to find out, which waypoint coordinate refers to a junction. it would be perfect, if it would be possible to get the information that this node is a junction, even if i don't have to make a turn at this node. another extra special would be, if i could get some additional information about the junction. e.g. the traffic rules at this junction or how many roads cross this junction. but first of all i need to know, wheter a node is a junction or not. thank you very much for your help, so far... 
Author:  Goverp [ 13 Aug 2013, 10:42 ] 
Post subject:  Re: Route path  which node is a junctions 
This answer is based on my reading of the route.c code over the last few weeks. It may be very wrong if I have misunderstood! I assume you want to know about junctions in the route.c context  things may be different in other navit parts such as the GUI or when generating turn instructions. As far as I have seen, there is no special handling for junctions. So determine if a point is a junction by counting the number of segments leading away from it (the list route_graph_point.start, if I remember correctly), but taking allowance of oneway and twoway streets. A point on a twoway street will not be a junction if exactly two segments start at it. A point on a oneway street will not be a junction if exactly one segment starts at it. It will be more complicated if there is a junction between a twoway street and several oneway streets. As you mention waypoints, I guess you have a route calculated. In that case, the point will have a segment (route_graph_point.seg, if I remember correctly) which points to the next segment to get to the destination. I think you can tell if the point is a junction on your route by looking at the list of segments starting at that point, and ignoring the segments (a) to the destination, and (b) the segment used to reach the point. If there are segments remaining, it's a junction. I guess you may need to look at the underlying item id to determine if your route changes items, in which case there might be road marking to make an explicit junction (such as "Give Way" or "Stop") but you may also need to look at the item depth to work out who has priority, if that matters. Hope that helps, and hope that it's correct! 
Page 1 of 1  All times are UTC 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ 