# Turns in the vector network analysis

The turntable can be created by v.net module, which is one of vector network analysis modules. Building the turntable allows you to model e.g. trafic code, where some turns may be prohibited. It creates a turntable with the costs for every possible turn on every possible node (intersection, crossroad) in given layer. U-turns are taken in account too.

For better handling, a linegraph is created. In this linegraph, every line is represented by two nodes. These nodes have positive and negative values respectively, with their absolute values identical. Every node corresponds to opposite line direction. The positive node matches the direction of line. The negative node matches the opposite direction. For better understanding, let's have a travelling subject standing on a line (road) before an intersection wanting to cross it. This line's direction is TOWARDS the intersection. Travelling from this line through the intersection means that the subject is currently standing on the POSITIVE node representation of the line. After crossing to this line from any permitted direction, the subject gets to the NEGATIVE point representation of the line.

These two nodes (corresponding to the same line) are connected with two U-turns (for both directions). Every U-turn direction belongs to another intersection. U-turn from the POSITIVE node to the NEGATIVE one belongs to the intersection we are going to cross. The other U-turn belongs to the intersection at the opposite end of this line.

**If features in analyzed network are changed, the turntable must be created again (e.g. it includes v.net connect operation). **

## Turntable description

Every record in the turntable represents one turn.

**Columns description:**

**cat**– category in**tlayer**(layer with turntable), which corresponds to both lines in turn

**ln_from**– unique category in**tuclayer**layer assigned to the starting line of the turn

**ln_to**– unique category in**tuclayer**layer assigned to the ending line line of the turn

**cost**– cost for turn (integer or double), assign -1 to close the turn

**isec**– point category in**tulayer**layer, which represents the intersection, where the turn belongs

**angle**– angle between the lines before and after the intersection (radians), positive -> turn to the right, negative -> turn to the left, 0 -> straight

Every possible turn on any possible intersection is represented by unique record (line). In the picture above you can see the turntable and part of vector layer with highlighted turn from the line with unique category 289 through the node (intersection) 561 to the line with unique category 234. In other words the given subject travels from intersection 564 through intersection 561 to intersection 527.

Arrows show orientation of each line. Note that in case of the line 289 the subject travels in BACKWARDS direction and therefore the In_from value is NEGATIVE (-289) while in case of the line 234 the travelling is in FORWARD direction, so the In_from value is POSITIVE (234). The category of this turn can be seen in the cat column and the value is 1817 (this kind of category is stored in tlayer). This category value belongs only to the lines with unique category values 234 and 289 (stored in tuclayer).

In the angle column for this record the value is -1.373597 radians which is roughly -80°. This perfectly makes sense since left turns have negative values and right turns have positive. The angle is measured as deviance from straight direction (which is 0°).

## Modules working with turntable

- v.net - creates the turntable

### Specific parameters of modules working with turntable

**alayer**- Name or number of the arc layer that will be expanded by turntable.

**tlayer**- Name or number of the layer to which the turntable will be attached.

**tuclayer**- Name or number of the layer with unique categories for every line and point. The points are placed on every node.

## WxGUI Vector Network Analysis Tool (not yet implemented)

In GUI for v.net modules there is the checkbox option to “use turns”. If checked, it is required to fill these additional parameters: tlayer (layer with turntable), tuclayer (layer with unique categories for turntable). The dialog is shown below.

It is possible to predefine costs for default or custom angle intervals in the Global settings dialog as shown in picture below.

The angle, however, is only the simple one between two straight lines (from previous intersection to current node and from current intersection to the next one ignoring any original shorter polyline segments). After the turntable is created, it is possible to customize costs explicitly for any specific turn on any given intersection (node) via the Local settings dialog.