NOTE (krankyd): these instructions could be dynamic. We'll try to keep this post updated whenever changes take place in the routing. == General comments == The description below fits a right turn in a right-hand side driving country (e.g. not England). As you may guess, Left turns are symmetrical to right turns. == Definitions == a) s-in: the segment going into the junction <br/> b) s-out: the segment going out of the junction <br/> c) s1, s2 … sN: all the segments connected to the same junction <br/> d) Best continuation - see expanded below == What is the 'best continuation'? == In order to determine if s-out is the 'real' continuation of s-in, we do the following: <br/> - if s-out has the same road type & street name it is selected as the real continuation. <br/> - if not, we look at the other segments: s3, s4 … sN. One of those will be chosen as a better continuation than s-out if both following conditions are met: <br/> * this segment has a better match street name & road type wise than s-out (e.g. it has the same street name and s-out doesn't; it has the same road type as s-in, and s-out doesn't). Street name is more important than road type. * the angle between this segment and s-in is smaller than the angle between s-out and s-in == The algorithm / list of conditions == The algorithm iterates over a list of conditions. As soon as a condition is met, the relevant instruction is determined, and the algorithm terminates.<br/> The list of conditions: 1. if the junction has only 2 segments, the instruction is: 'CONTINUE'.<br/> 1.1. In some cases, T junctions could be considered as only 2 segments. See explanation on 'T junctions' below. 2. if the angle between s-out and the best continuation is larger than 45 degrees (and less than 180), the instruction is: 'TURN RIGHT' <br/> 2.1 One assumption is that on primary roads (minor highways, major highways and freeways), we won't have angles which are larger than 45 degrees. 3. if s-out is determined to be the best continuation of s-in (explanation on 'best continuation' below), the instruction is: 'CONTINUE' 4. if s-in is a primary road and s-out is not a primary road, the instruction is: 'EXIT RIGHT' 5. if s-in is a ramp/exit and s-out is neither primary nor ramp/exit, the instruction is: 'EXIT RIGHT' 6. if none of the above conditions is met, the instruction is: 'KEEP RIGHT' <br/><br/> == T junctions and one way roads == In some cases, a node could have more than 2 segments, but the routing server will consider only 2 of them as valid and therefore, the maneuver will be 'Continue straight'.<br/> Nodes can become locked on specific scenarios - see here Roundabouts for more information.<br/><br/> For example, in this case (image below) - assuming the node is locked - heading south, the right turn will be considered 'Continue straight' as the routing server has no other option and there's only one possible segment to be s-out.<br/> If the node was not locked, most likely that waze would tell you to turn right. Driving against the direction is a high penalty, and so is a left turn where a turn is not allowed. However, it would still have been an option, which is why the routing server would have called it 'turn right'.<br/><br/> This could be confusing, especially since there's no external indication on whether or not a node is locked at the moment. We will add it to the Papyrus soon.