Turn Restrictions

Top  Previous  Next

Calculations can be performed calculations in two modes: With or without support for turn restrictions. If you sepcify a turn.txt file, turnmode is automatically used. The internal working of the two modes are quite different, which means performance and RAM requirements are also different:

 

Turn restriction mode is app. 2 times as slow as normal mode.

Allowing U-turns slow the calculations down further (app. 30%).

Turn restriction mode takes up more RAM.

 

When adding restrictions to the network you can choose between either a 100% restriction (any negative value) or a delay expressed in the same unit as costs. If cost is measured in minutes, using "1" would add a delay of 1 minute for a specific turn. This could be e.g. a left-turn in countries with right-side driving or vice-versa. Don't use turn-delays combined with shortest path routes - it just wouldn't make sense to add a 1 km to the route, since the reported distances would be wrong.

 

When querying a route the delay is added just after the turn has been performed: A delay of 2 minutes at node B has no impact on the cost of going from node A to node B, whereas if you move on to the next node, the 2 minutes are reflected in the next node on the route.

 

Defining turn restrictions

 

The format one or more lines, where each line stores one restriction with parameters stored in space seperated format. Different types of restrictions are possible:

 

0: Simple Turn restriction, 2 external link IDs + 1 cost value

1: Simple Turn restriction, 2 link IDs + 1 cost value

2: TurnStandard, coordinates for node

3: Mandatory turn, 2 external link IDs

4: Mandatory turn, 2 link IDs

5: Complex Turn restriction, >2 external link IDs + 1 cost value

6: Complex Turn restriction, >2 link IDs + 1 cost value

 

Simple and complex turn restrictions are both declared as a sequence of links, defining the turn.

A "turnstandard" restriction is one where it is only allowed to drive straight through the intersection. Typically used for overpasses - see also 3D nodes.

A mandatory turn is one, where the turn after link1 has to be to link2.

 

File example:

 

// comment

0 A4003234 A4003127 -1

1 456 230 -1

2 -77.024098 38.902711

3 A4003234 A4003127

4 456 230

5 A4003279 A4003234 A4003127 -1

6 89 456 230 -1

 

Lines starting with // are ignored as comments.

 

Version 2.00 - 3.11 reads restriction type 1 and 2.

Version 3.12 - 3.15 reads all types.

 

Complex turn restrictions are ignored so far.

 

The free ITN converter will create turn restriction files in this format.