Step 5: Building Turn Restrictions


This step is optional, the road network can be used without turn restrictions.

 

Turn restrictions prohibit traffic from turning to the left, or to the right, or from going straight. The Road Network Builder utility can build a turn restrictions index (.tri) file from an XML file with turn restrictions. The index file will be opened by the Network.Open method automatically to be used in route calculations.

Turn Restrictions XML Format

Below is an example of a turn restrictions XML file for the roads.shp map file (\MAPS\ROUTING\turn_restrictions.xml).

 

<?xml version="1.0"?>
<TurnRestrictions>
<tr from="3081" to="2398" mode="0"/>
<tr from="1907" to="1910" mode="2" dayOn="4" dayOff="5"/>
<tr from="3097" to="2355" mode="0" timeOn="12:00" timeOff="14:00"/>
<tr from="2401" to="2403" mode="0" dayOn="Fri" dayOff="Sat" timeOn="16:00" timeOff="20:00"/>
</TurnRestrictions>

 

Turn restriction attributes are enclosed inside <tr> tags. A <tr> tag can contain the following attributes:

 

Name Type Description
from string The unique ID of a road segment from which the restriction starts.

The roads.shp file has the ID field which uniquely identifies the roads segments.

 

from="3081"

to string The unique ID of a road segment that defines where the restriction ends.

From/to segments must have a common start/end point (node).

 

to="2398"

mode  (optional) number The transportation mode (0 by default).

If this attribute is set and it is not zero, the restriction will be used in route calculations if it's mode value match the value of the Route.TransportationMode property.

If the mode is not set or is zero, the restriction will be used always, even if the TransportationMode property is not zero.

 

mode="0"

mode="1"

dayOn  (optional) number or string Day of week as numbers (0 - Sunday, 1 - Monday, .. 6 - Saturday) or full/abbreviated day names:


dayOn="1"

dayOn="Monday"

dayOn="Mon"

dayOff  (optional) number or string Day of week as numbers (0 - Sunday, 1 - Monday, .. 6 - Saturday) or full/abbreviated day names:


dayOff="5"

dayOff="Friday"

dayOff="Fri"

timeOn  (optional) string Time of day in 24-hour format. (00:00 - 23:59)

 

timeOn="16:00"

timeOff  (optional) string Time of day in 24-hour format. (00:00 - 23:59)

 

timeOff="20:00"

 

Examples:

 

No right turn.

 

<tr from="1003" to="1002"/>

No right turn from Monday to Friday.

 

<tr from="1003" to="1002" dayOn="Mon" dayOff="Fri"/>

No right turn from 10am to 6pm.

 

<tr from="1003" to="1002" timeOn="10:00" timeOff="18:00"/>

 

No right turn from Monday to Friday, 10am to 6pm.

 

<tr from="1003" to="1002" dayOn="Mon" dayOff="Fri" timeOn="10:00" timeOff="18:00"/>

 

No right turn for trucks. The mode value for trucks is defined by the user.

 

<tr from="1003" to="1002" mode="2"/>

No straight through.

 

<tr from="1003" to="1004"/>

Proceed straight (no turns). This traffic rule requires two turn restrictions.

 

<tr from="1003" to="1001"/>

<tr from="1003" to="1002"/>

 

 

Building Turn Restrictions Index File

Open the 'Turn Restrictions' tab and select the road.shp file as the map file and the roads_restrictions.xml file as the turn restrictions XML file. Select the 'ID' field as the segment ID field. The ID field uniquely identifies the roads segments in the road.shp file.

 

 

Click the 'Build turn restrictions index' button. The Road Network Builder utility will report the number of turn restrictions that have been added to the index file. This number may be less than the total number of turn restrictions in the XML file.

 

 

The index file has been created in the same folder as the map file and has the same name and .tri as the file extension - roads.tri. The index file now can be opened by the Network.Open method.

 

Congratulations! You just completed the final step. We hope that by going through this chapter, you have gained a solid background in building road networks.

 

 

 

 

 

 

© 2018 VDS Technologies
Converted from CHM to HTML with chm2web Standard 2.85 (unicode)