imported>PesachZ (replacing page content with new draft information a/p http://www.waze.com/forum/viewtopic.php?f=276&t=91105) |
imported>PesachZ (fixed links to transclusions) |
||
Line 18: | Line 18: | ||
*'''Best Continuation: '''One of the segments leaving the junction will be considered the 'Best Continuation'. This is the segment that Waze determines is what drivers would consider the "no turning path" or "going straight" through the intersection. This segment will get a 'continue' instruction, which is ignored by the client app. The criteria Waze uses to determine which segment is the 'Best Continuation' is explained below. | *'''Best Continuation: '''One of the segments leaving the junction will be considered the 'Best Continuation'. This is the segment that Waze determines is what drivers would consider the "no turning path" or "going straight" through the intersection. This segment will get a 'continue' instruction, which is ignored by the client app. The criteria Waze uses to determine which segment is the 'Best Continuation' is explained below. | ||
*'''Primary road:''' refers to a highway segment ({{Freeway}}, {{Major Highway}}, or {{Minor Highway}}), not a {{Primary Street}}. | *'''Primary road:''' refers to a highway segment ({{Freeway}}, {{Major Highway}}, or {{Minor Highway}}), not a {{Primary Street}}. | ||
*The '''angle''' is the angle from the origin to the destination. A perfectly straight road with a junction in the middle would have a turn angle is 0°. The angle then gets wider as you turn to either side. A perfect left or right turn would be 90°. A U-turn at a junction between two segments would represent a 180° turn.<br>(A turn less than {{: | *The '''angle''' is the angle from the origin to the destination. A perfectly straight road with a junction in the middle would have a turn angle is 0°. The angle then gets wider as you turn to either side. A perfect left or right turn would be 90°. A U-turn at a junction between two segments would represent a 180° turn.<br>(A turn less than {{:How_Waze_determines_turn_/_keep_/_exit_maneuvers/Stay threshold}} will give a keep/stay instruction, vs. a turn more than {{:How_Waze_determines_turn_/_keep_/_exit_maneuvers/Turn threshold}} which gives a turn instruction.) | ||
**In technical terms: The angle between the linear segment between the last geometry node of s-in and the junction and the linear segment between the junction and the first geometry node of sN is the supplementary angle to the angle of sN. | **In technical terms: The angle between the linear segment between the last geometry node of s-in and the junction and the linear segment between the junction and the first geometry node of sN is the supplementary angle to the angle of sN. | ||
{| class="Wikitable" style="text-align:center; border: 1px solid darkgray;" cellpadding="5" border="1" | {| class="Wikitable" style="text-align:center; border: 1px solid darkgray;" cellpadding="5" border="1" | ||
Line 47: | Line 47: | ||
In order to determine if s-out is the 'real' continuation of s-in, Waze does the following: | In order to determine if s-out is the 'real' continuation of s-in, Waze does the following: | ||
:If the angle between s-in and s-out is less than {{: | :If the angle between s-in and s-out is less than {{:How_Waze_determines_turn_/_keep_/_exit_maneuvers/Stay threshold}}, it is selected as the real continuation, unless one of the following are present. | ||
:*There is another segment (s1, s2, ...sN) with an angle less than {{: | :*There is another segment (s1, s2, ...sN) with an angle less than {{:How_Waze_determines_turn_/_keep_/_exit_maneuvers/Stay threshold}} which has a better matching segment name & segment type to s-in than s-out does. (e.g. it has the same segment name and type as s-in and s-out doesn't; it has the same segment name as s-in and s-out doesn't; it has the same segment type as s-in, and s-out doesn't.) Segment name is more important than segment type. | ||
:*There is another segment(s1, s2, ...sN) with an angle less than {{: | :*There is another segment(s1, s2, ...sN) with an angle less than {{:How_Waze_determines_turn_/_keep_/_exit_maneuvers/Stay threshold}} which has the same segment name & segment type as s-out. | ||
If a 'best continuation' is determined, Waze will not give an instruction going onto that segment. | If a 'best continuation' is determined, Waze will not give an instruction going onto that segment. | ||
Line 57: | Line 57: | ||
=== Special Considerations === | === Special Considerations === | ||
*In some situations at a [[Junction Style Guide#Y Intersections|Y-Intersection]] (where there are more than one segment leaving the junction node at less than a {{: | *In some situations at a [[Junction Style Guide#Y Intersections|Y-Intersection]] (where there are more than one segment leaving the junction node at less than a {{:How_Waze_determines_turn_/_keep_/_exit_maneuvers/Stay threshold}} angle), navigation to either segment will generate a 'KEEP RIGHT/LEFT" instruction. This will happen if none of the segments leading out at less than {{:How_Waze_determines_turn_/_keep_/_exit_maneuvers/Stay threshold}} are a better match for name or segment type, even if one of those has a departure angle of 0° from s-in. This is also mentioned in the [[Junction Style Guide#Wayfinder Segments|wayfinder section]]. | ||
*A segment (s1, s2, ...sN) leaving the junction at less than a {{: | *A segment (s1, s2, ...sN) leaving the junction at less than a {{:How_Waze_determines_turn_/_keep_/_exit_maneuvers/Stay threshold}} angle, which has the turn into it from s-in [[Turn restrictions#Turn restrictions .28allowed turns.29|restricted]] in [[Waze Map Editor|WME]] will not be considered in this algorithm as a 'best continuation', or as a sN, even if it has a departure angle of 0° from s-in. | ||
*There will '''not always''' be a ''best combination''. | *There will '''not always''' be a ''best combination''. | ||
**When s-out has the same segment name and segment type as s-in, but another s-N also has the same segment name and type as s-N, neither will be considered the ''best continuation''. | **When s-out has the same segment name and segment type as s-in, but another s-N also has the same segment name and type as s-N, neither will be considered the ''best continuation''. | ||
Line 84: | Line 84: | ||
=== Special considerations === | === Special considerations === | ||
*The direction of a turn which is less than {{: | *The direction of a turn which is less than {{:How_Waze_determines_turn_/_keep_/_exit_maneuvers/Stay threshold}} is measured relative to the other segments at the junction less than {{:How_Waze_determines_turn_/_keep_/_exit_maneuvers/Stay threshold}}. | ||
**A junction with two segments that are less than {{: | **A junction with two segments that are less than {{:How_Waze_determines_turn_/_keep_/_exit_maneuvers/Stay threshold}} will give a KEEP RIGHT to the right branch, even if it is to the left of a straight line. | ||
*When there are more than two segments less than {{: | *When there are more than two segments less than {{:How_Waze_determines_turn_/_keep_/_exit_maneuvers/Stay threshold}}, only the left most segment will be KEEP LEFT, all the rest will be KEEP RIGHT. | ||
**If the left most segment is overlapping another segment, it will also be KEEP RIGHT. | **If the left most segment is overlapping another segment, it will also be KEEP RIGHT. | ||
*If the only two segments less than {{: | *If the only two segments less than {{:How_Waze_determines_turn_/_keep_/_exit_maneuvers/Stay threshold}} overlap each other, neither will get an instruction. | ||
*In some cases, a junction node could have more than two segments, but the routing server will only consider two of them as valid and therefore, the maneuver will be 'Continue straight'. This happens when turns into some of the segments are [[Turn restrictions#Turn restrictions .28allowed turns.29|restricted]], the routing server then skips those segments and ingores them when determining the 'Best Continuation'. | *In some cases, a junction node could have more than two segments, but the routing server will only consider two of them as valid and therefore, the maneuver will be 'Continue straight'. This happens when turns into some of the segments are [[Turn restrictions#Turn restrictions .28allowed turns.29|restricted]], the routing server then skips those segments and ingores them when determining the 'Best Continuation'. | ||
**At the time of this writing, neither the author or anyone involved in the discussion has ever experienced this unless the restricted segment has a turn angle of less than {{: | **At the time of this writing, neither the author or anyone involved in the discussion has ever experienced this unless the restricted segment has a turn angle of less than {{:How_Waze_determines_turn_/_keep_/_exit_maneuvers/Stay threshold}}. | ||
*Turns can be [[Turn restrictions#Turn restrictions .28allowed turns.29|restricted or unrestricted]]. In specific scenarios you may not be able to see this in [[Waze Map Editor|WME]] - see [[Reverse connectivity#Reverse Connectivity|RevCons]] for more information. There are external scripts which show this information (and some allow it to be easily corrected). | *Turns can be [[Turn restrictions#Turn restrictions .28allowed turns.29|restricted or unrestricted]]. In specific scenarios you may not be able to see this in [[Waze Map Editor|WME]] - see [[Reverse connectivity#Reverse Connectivity|RevCons]] for more information. There are external scripts which show this information (and some allow it to be easily corrected). |
Revision as of 18:10, 22 June 2014
A somewhat simplified description of this is covered in the Junction Style Guide. Additional routing information is covered in the article Routing server.
The original text provided by Waze staff which inspired this page was proven slightly inaccurate, and was difficult to comprehend it was replaced on 06/22/2014.
A simplified easy to understand interactive version of this page is available here.
Definitions
To better be able to put the algorithm into words, we have to name each of the road segments that connect to a junction. These are subjective names, they are relative to which segment the junction is being approached from, and which segment the routing server wants to navigate to after passing through the junction.
Start with the junction in the middle.
- s-in: The segment the vehicle is on as it approaches the junction will be called s-in.
- s-out: The segment the vehicle is being routed onto after it passes through the junction will be called s-out. This can be any of the other segments connected to the junction, which will also be one of the segments named below as s1, s2, ... etc..
- s1, s2, s3, s4, etc.: All the segments connected to the same junction, (including s-out) will each be named consecutively as s1, s2, etc., for as many segments as there are… sN. One of these numbered segments will also be s-out.
- Best Continuation: One of the segments leaving the junction will be considered the 'Best Continuation'. This is the segment that Waze determines is what drivers would consider the "no turning path" or "going straight" through the intersection. This segment will get a 'continue' instruction, which is ignored by the client app. The criteria Waze uses to determine which segment is the 'Best Continuation' is explained below.
- Primary road: refers to a highway segment ( Freeway , Major Highway , or Minor Highway ), not a Primary Street .
- The angle is the angle from the origin to the destination. A perfectly straight road with a junction in the middle would have a turn angle is 0°. The angle then gets wider as you turn to either side. A perfect left or right turn would be 90°. A U-turn at a junction between two segments would represent a 180° turn.
(A turn less than
- REDIRECT USA:How Waze determines turn / keep / exit maneuvers/Stay threshold will give a keep/stay instruction, vs. a turn more than
- REDIRECT USA:How Waze determines turn / keep / exit maneuvers/Turn threshold which gives a turn instruction.)
- In technical terms: The angle between the linear segment between the last geometry node of s-in and the junction and the linear segment between the junction and the first geometry node of sN is the supplementary angle to the angle of sN.
Angles | ||
---|---|---|
![]() |
![]() |
![]() |
Standard Angles | 37° Angle | 90° Dogleg Geometry Node |
- A Normal Roundabout is one which has
- Four (4) or less exits,
- All exits leave the roundabout (from the perspective of s-in) at a normal angle.
- A Normal Angle is 0° or 90° to either side, ±15°. (See roundabout angle for more information)
- An Abnormal Roundabout is one which has
- Five (5) or more exits,
- At least one exit leaves the roundabout (from the perspective of s-in) at an abnormal angle.
- A Abnormal Angle is anything other than; 0° or 90° to either side, ±15°. (See roundabout angle for more information)
![Visualize how segments are subjectively named in the 'Best Continuation' Algorithm](https://storage.googleapis.com/wazeopedia-prd-glb-files/9/97/S-in_s-out_definition.jpg)
Best Continuation
In order to determine if s-out is the 'real' continuation of s-in, Waze does the following:
- If the angle between s-in and s-out is less than
- REDIRECT USA:How Waze determines turn / keep / exit maneuvers/Stay threshold, it is selected as the real continuation, unless one of the following are present.
- There is another segment (s1, s2, ...sN) with an angle less than
- REDIRECT USA:How Waze determines turn / keep / exit maneuvers/Stay threshold which has a better matching segment name & segment type to s-in than s-out does. (e.g. it has the same segment name and type as s-in and s-out doesn't; it has the same segment name as s-in and s-out doesn't; it has the same segment type as s-in, and s-out doesn't.) Segment name is more important than segment type.
- There is another segment(s1, s2, ...sN) with an angle less than
- REDIRECT USA:How Waze determines turn / keep / exit maneuvers/Stay threshold which has the same segment name & segment type as s-out.
If a 'best continuation' is determined, Waze will not give an instruction going onto that segment.
![Flowchart defining the steps the algorithm runs through.](https://www.waze.com/wiki/Commons/thumb.php?f=Best_continuation.png&width=700)
Special Considerations
- In some situations at a Y-Intersection (where there are more than one segment leaving the junction node at less than a
- REDIRECT USA:How Waze determines turn / keep / exit maneuvers/Stay threshold angle), navigation to either segment will generate a 'KEEP RIGHT/LEFT" instruction. This will happen if none of the segments leading out at less than
- REDIRECT USA:How Waze determines turn / keep / exit maneuvers/Stay threshold are a better match for name or segment type, even if one of those has a departure angle of 0° from s-in. This is also mentioned in the wayfinder section.
- A segment (s1, s2, ...sN) leaving the junction at less than a
- REDIRECT USA:How Waze determines turn / keep / exit maneuvers/Stay threshold angle, which has the turn into it from s-in restricted in WME will not be considered in this algorithm as a 'best continuation', or as a sN, even if it has a departure angle of 0° from s-in.
- There will not always be a best combination.
- When s-out has the same segment name and segment type as s-in, but another s-N also has the same segment name and type as s-N, neither will be considered the best continuation.
The algorithm
The description below fits a right turn in a Right-hand traffic country (e.g. the USA). Left turns are symmetrical to right turns.
The algorithm iterates over a list of conditions. As soon as a condition is met, the relevant instruction is determined, and the algorithm terminates.
The list of conditions
- If the junction has only 2 segments, the instruction is: 'CONTINUE'.
By design the client does not give this instruction. - If s-out is determined to be the best continuation of s-in (see explanation on 'best continuation' above), the instruction is: 'CONTINUE', which implies that the driver is not turning (i.e., going straight through the junction).
By design the client does not give this instruction. - If the angle between s-out and a straight line is larger than 45 degrees, the instruction is: 'TURN RIGHT'.
- This is because we assume that on primary roads ( freeways , major highways , and minor highways ), turn angles are less than 45 degrees (no sharp turns on higher-throughput roads). Therefore, you never have something called an "exit" that has such an angle, and the instruction should be TURN, not EXIT.
- If s-in is a primary road ( FW , MH , mH ) and s-out is not a primary road ( FW , MH , mH ), the instruction is: 'EXIT RIGHT'.
- If s-in is a ramp/exit and s-out is neither a primary road ( FW , MH , mH ), nor a ramp/exit , the instruction is: 'EXIT RIGHT'.
- NOTE: in a RHT country there is no EXIT LEFT, in a LHT country there is no EXIT RIGHT.
- If none of the above conditions are met, the instruction is: 'KEEP RIGHT'.
Graphic flowchart
This is a static graphic flowchart starting from a junction point and flowing through (all) the possible configuration options, to hopefully cover any scenario. It culminates in all the possible navigation instructions. This chart includes roundabouts, Left Hand Traffic, and Right Hand Traffic. For an interactive version with mite descriptions and illustrations are the interactive page.
![](https://www.waze.com/wiki/Commons/thumb.php?f=Turn_algorithm_flowchart.png&width=700)
Special considerations
- The direction of a turn which is less than
- REDIRECT USA:How Waze determines turn / keep / exit maneuvers/Stay threshold is measured relative to the other segments at the junction less than
- REDIRECT USA:How Waze determines turn / keep / exit maneuvers/Stay threshold.
- A junction with two segments that are less than
- REDIRECT USA:How Waze determines turn / keep / exit maneuvers/Stay threshold will give a KEEP RIGHT to the right branch, even if it is to the left of a straight line.
- When there are more than two segments less than
- REDIRECT USA:How Waze determines turn / keep / exit maneuvers/Stay threshold, only the left most segment will be KEEP LEFT, all the rest will be KEEP RIGHT.
- If the left most segment is overlapping another segment, it will also be KEEP RIGHT.
- If the only two segments less than
- REDIRECT USA:How Waze determines turn / keep / exit maneuvers/Stay threshold overlap each other, neither will get an instruction.
- In some cases, a junction node could have more than two segments, but the routing server will only consider two of them as valid and therefore, the maneuver will be 'Continue straight'. This happens when turns into some of the segments are restricted, the routing server then skips those segments and ingores them when determining the 'Best Continuation'.
- At the time of this writing, neither the author or anyone involved in the discussion has ever experienced this unless the restricted segment has a turn angle of less than
- Turns can be restricted or unrestricted. In specific scenarios you may not be able to see this in WME - see RevCons for more information. There are external scripts which show this information (and some allow it to be easily corrected).
- The original text mentions special behavior for locked nodes. 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.
- If the node was not locked, it is 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'.
- This could be confusing, especially since there's no external indication on whether or not a node is locked at the moment.
- The author and those involved in the discussion have never experienced a locked node which didn't follow the algorithm for determining the instruction.