How To: Model global turn penalties using the default turn evaluator
To model a turn penalty for all possible turns, it is not necessary to create a turn feature for every pair of adjacent edges in the network dataset. Global turn penalties can be modeled by specifying the Default Turn evaluator on a network attribute to be either the Global Turn Delay evaluator or the VB Script evaluator.
See the Related Information section below for more information about the Global Turn Delay evaluator. The Global Turn Delay evaluator is only available in version 9.3 or later.
Instructions provided demonstrate how to use the VB Script evaluator to add a 15-second turn penalty to all left turns, while not penalizing all other turns. The network attribute in this example is assumed to have its Units set to Minutes.
For users of version 9.3 or later, it is strongly recommended to use the Global Turn Delay evaluator instead of the VB Script evaluator. The Global Turn Delay evaluator runs much faster than the VB Script evaluator.
- In ArcCatalog, right-click the network dataset and select Properties to open the Network Dataset Properties dialog box.
- Select the Attributes tab.
- Select the cost attribute to add the turn penalties to, and click the Evaluators button to open the Evaluators dialog box.
- Select the Default values tab.
- For the Turn evaluator, under the Type column, change the Type from Constant to VB Script.
- Click the Evaluator Properties button to open the Script Evaluators dialog box.
- In the Pre-Logic VB Script Code box, type in the following code:
turnTime = 0
a = Turn.Angle
If a > 210 And a < 330 Then
turnTime = 0.25
Turn.Angle is measured in degrees clockwise from straight ahead.
For more information on the usage of Turn.Angle, see the link for INetworkTurn.Angle Property in the Related Information section below.
Since this network attribute has its Units set to Minutes, the attribute value must be specified in minutes (0.25 minutes = 15 seconds).
- In the Value box, type in:
- Click OK on the Script Evaluators dialog box.
- Click OK on the Evaluators dialog box.
- Click OK on the Network Dataset Properties dialog box.
- About the global turn delay evaluator (ArcGIS Desktop Help)
- INetworkTurn.Angle Property (ArcObjects Library Reference)