Types of evaluators used by a network

Each attribute defined in the network must have values for each source participating in the network. An evaluator assigns values for the attribute of each source. In the precursors of ArcGIS (ARC/INFO and ArcView GIS), values for attributes were assigned from a field in the shapefile or coverage. In ArcGIS, the field evaluator assigns values to a network attribute from a field of a network source. In addition, ArcGIS offers other types of evaluators that can be used, for instance, constant, field expression, function, and script evaluators.

The evaluators are described below.

Evaluator

Description

Field evaluator

The most common way to assign values for a network attribute is by identifying a single field that will be used to evaluate the network attribute when the network dataset is built. For example, a field evaluator can be used in cases where the value describes a measurement, such as the length of each road segment in meters.

Field expression evaluator

The field evaluator can be modified to take a field expression as the value instead of a single field. In this case, you'll build an expression on the Field Evaluator dialog box using VBScript or Python. For example, if the units of the network attribute are in meters but the units of source data are in feet, you can create an expression to convert the feet into meters when the network dataset is built.

TipTip:

Field expression evaluators written in VBScript execute much faster than those written in Python. You should try to use VBScript for this reason; however, keep in mind the following points when choosing a scripting language:

  • Most ArcGIS products can interpret VBScript or Python.
  • ArcGIS for Server (Linux) can interpret Python only.
  • The script in a field expression evaluator is interpreted when the network dataset is built.
The logical implications of these points are the following:
  • If you plan to build the network dataset using any ArcGIS product other than ArcGIS for Server (Linux), then you can write the script in VBScript.
  • If you plan to build the network dataset on ArcGIS for Server (Linux), then you must write it in Python.
  • If you plan to build the network dataset using any ArcGIS product other than ArcGIS for Server (Linux), then use ArcGIS for Server (Linux) to solve network analyses that reference the built network dataset, you can write the script in VBScript.

Constant evaluator

Attributes can be assigned a constant value. The value can be numeric (0, 1, 2) for cost, descriptor, and hierarchy attributes, or a Boolean data type of Use Restriction or Ignore Restriction for a restriction attribute.

Function evaluator

The function evaluator calculates attribute values by performing a multiplicative or logical function on another attribute value or parameter value. For numeric attribute types, the values are derived from an expression that multiplies the value of another attribute by some value, for example, DriveTime * 1.25. For Boolean attribute types, the values are derived from an expression that compares another attribute value to a parameter value, for example, MaxHeight < VehicleHeight.

Global turn delay evaluator

The global turn delay evaluator assigns a default cost value for transitioning between two edge elements. The cost is based on the deflection angle between the two edges and the road class (primary, secondary, or local) of the edges that are traversed. You specify the road class using the Hierarchy Ranges dialog box along with a hierarchy attribute. For example, you can use the global turn delay evaluator to make all left turns, which are determined by deflection angles, from local roads onto secondary roads take longer than left turns from local roads onto other local roads. You can also specify added costs for other transitions, such as adding 10-second delays when continuing straight at the intersection of two secondary roads.

Learn more about establishing global turns

Script evaluator

Attributes can be assigned from the result of executing a VBScript or Python script. This provides a way to model complex attributes. Unlike other evaluators, the script evaluator does not assign values when a network is built. Instead, it assigns values when a particular network analysis requires the use of that attribute, which can occur at solve time. If the values of an attribute change constantly, the use of a script evaluator can ensure attributes are updated for each network analysis.

TipTip:

Since the script evaluator calculates its values at the time of analysis, this evaluator tends to negatively affect analysis performance. Try to use another evaluator if possible.

Script evaluators written in VBScript execute much faster than those written in Python. You should try to use VBScript for this reason; however, keep in mind the following points when choosing a scripting language:

  • Most ArcGIS products can interpret VBScript or Python.
  • ArcGIS for Server (Linux) can interpret Python only.
  • The script in a script evaluator is interpreted when a network analysis layer is solved.
The logical implications of these points are the following:
  • If you plan to solve network analyses using any ArcGIS product other than ArcGIS for Server (Linux), then you can write the script in VBScript.
  • If you plan to solve analyses on ArcGIS for Server (Linux), then you must write it in Python.

Edge traffic evaluator

Edge traffic evaluators are designed for traffic data. They can provide travel times for a given time of day and day of the week using historical or live data. They include fallback cost attributes that provide weekday and weekend travel times when specific time-of-day travel times are not available. Edge traffic evaluators also have a time-neutral cost attribute that Network Analyst references when sequencing stops in a route analysis or visits in a vehicle routing problem.

Learn more about traffic data

Every junction source and every turn source can have one evaluator. Every edge source can have two—one for each digitized direction of the edge.

A default evaluator can be assigned for edges, junctions, and turns. If an explicit evaluator is not specified for a particular source, the values for that source are assigned by the default evaluator.

The following is the general workflow for assigning an evaluator:

  1. Select the source for which the evaluator must be assigned.
  2. Choose an evaluator type, such as Field, Constant, Function, or Script.
  3. Specify the value to be assigned to the network attribute.

    If the values are derived from a field, the field will be selected from a drop-down menu. If the values are to be calculated based on a field expression, set evaluator type as Field and press F12 on your keyboard to bring up the Field Evaluators dialog box. Alternatively, you can right-click the source on the Evaluators dialog box and choose Properties from the Value menu to open the Field Evaluators dialog box.

Evaluator examples

Assigning values to cost attributes

The DriveTime network attribute in the graphic below uses a field evaluator for the Streets source feature class. This is indicated under the Type column. The Value column shows that the FT_Minutes field supplies the network attribute values for the from-to direction of the Streets source. Similarly, values for the to-from direction of the streets source are drawn from the field TF_Minutes.

In this example, the other edge sources in this network are transit edges and do not have a drive time. Hence, they can be assigned a constant value of -1, or better, a constant value of zero and given restriction attributes that prohibit automobiles and other street vehicles.

Dive-inDive-in:

Restrictions, rather than negative costs, are preferred because negative costs are subtracted when accumulating cost attributes.

Assigning values to cost attributes

Alternatively, cost attributes can be derived from another cost attribute by using the function evaluator. For example, an attribute that models the travel times of slow vehicles can use the function evaluator to reference an attribute that models normal travel times and multiply it by a slowdown factor.

Function evaluator modeling a longer travel time

Assigning values to restrictions

Restriction attributes have a Boolean data type. Since a source element can either use or ignore the associated restriction, it can be assigned a constant value of Use Restriction or Ignore Restriction.

Assigning values to restrictions

Alternatively, restriction attributes can be derived using the function evaluator to compare another attribute to a parameter value. For example, an attribute that models vehicle height restrictions can use the function evaluator to compare the height limit of a road to the vehicle's actual height stored in an attribute parameter. When the expression evaluates to true, the restriction is used on the road; when the expression evaluates to false, the restriction is ignored. The exception to this rule is that anytime either of the operands (MaxHeight or Vehicle Height) have a value of zero, the expression always evaluates to false.

Function evaluator modeling a height restriction

Learn more about using parameters with network attributes

Restriction attributes can also be assigned from a field in the source feature class. For example, you can use a field expression evaluator to generate Boolean results—if the expression is true, the element uses the restriction; if not, the element ignores the restriction.

When a network dataset is created, the ArcGIS Network Analyst extension searches through all sources for commonly used fields, such as Oneway. If it finds a Oneway field in any source, it creates a Oneway network attribute and assigns values for the relevant source based on field expressions.

Below are two screen captures of the VBScript expression for a one-way restriction attribute. There is one evaluator and expression for each digitized direction of the street.

Field expression evaluator for the From-To direction (VBScript)
Field expression evaluator for the To-From direction (VBScript)

These expressions determine the permitted directions of travel based on the text value in the Oneway field:

  • FT or F = Travel is only permitted in the digitized direction of the line feature (the from-to direction).
  • TF or T = Travel is only permitted against the digitized direction of the line feature (the to-from direction).
  • N = Travel is not permitted in either direction.
  • Any other value = Travel is permitted in both directions.

NoteNote:

Although VBScript is recommended for network evaluators, you will need to write scripts in Python if the evaluator will be executed on ArcGIS for Server (Linux). What you type in the Pre-Logic Script Code and Value = sections of the evaluator dialog box varies between VBScript and Python.

For VBScript, you write an expression in Pre-Logic Script Code that sets a variable, then set Value = to that variable.

To write a Python evaluator, you need to write a function in the Pre-Logic Script Code text box, starting with the def keyword, return a value at some point with the return keyword, then call the function from the Value = text box. Below are two screen captures illustrating how to write a Python field expression evaluator for setting a one-way restriction. Compare it to the VBScript example above to better understand the differences between writing evaluator expressions in VBScript and Python.

Field expression evaluator for the From-To direction (Python)
Field expression evaluator for the To-From direction (Python)
Also note that the if-statement in the Python example above uses a compound logical expression, rather than a simple logical expression, to catch null values and avoid errors. If value is removed from if value and value.upper() in ('N', 'FT', 'F'):, and a null value is passed in from the ONEWAY field, an error would occur because the value.upper() function can't handle null values. Instead, value evaluates to false, and Python immediately exits the if-statement before evaluating value.upper().

Restriction Usage parameter

A restriction attribute always has an associated parameter named Restriction Usage, which determines whether elements that use the restriction are prohibited, merely avoided, or even preferred. In most cases, you will set Restriction Usage to Prohibited, but there are several cases in which you could choose otherwise.

Learn more about Restriction Usage

Assigning hierarchies

By assigning hierarchies on your network dataset, you can categorize edges into different hierarchical levels and thus reduce solve times. However, keep in mind that results of hierarchical solves may be less optimal than non-hierarchical solves. It is recommended that you also read About network analysis with hierarchy to gain a better understanding of what hierarchies are and why they might be used.

Hierarchy levels are defined by consecutive integers, starting from one. The lowest integer—that is, one—represents the highest level of the hierarchy. Higher integer values represent lower hierarchy levels. For instance, if you are breaking a network down into three hierarchy levels, you would assign the primary roads a value of 1, secondary roads a value of 2, and tertiary roads a value of 3. The primary roads might include interstate highways while tertiary roads might include residential streets.

Hierarchy in a network dataset is often assigned via a field or field expression evaluator. If the Streets feature class has a road class attribute (Hierarchy) with values 1, 2, and 3—representing interstates, major roads, and minor roads, respectively—the hierarchy attribute can be set by simply using field evaluators.

Assigning hierarchy

Typically, three, four, or five levels of hierarchy are assigned to a hierarchy attribute, but you can assign as many as you want, as long as each level is represented by a consecutive integer starting from one. You should avoid assigning too many levels of hierarchy, however, as this could leave some edges disconnected with respect to the rest of the hierarchy, which would cause failures when solving network analysis layers.

If the source feature class has an attribute that categorizes roads into more groups than you want as levels in your hierarchy, you can further categorize the groups using a field expression evaluator so that you achieve the number of hierarchy levels you want. For example, assume a Streets feature class has an integer field named Func_Class that has the following six road classes:

Func_Class

Street type

1

Interstate

2

Interstate toll road

3

State highway

4

Major road

5

Local street

6

Freeway ramp

Furthermore, assume that you want to group the Func_Class values as shown in the following table so that three hierarchy levels are created.

Hierarchy level

Func_Class values

1

1 (interstates)

2 (interstate toll roads)

6 (freeway ramps)

2

3 (state highways)

4 (major roads)

3

5 (local streets)

To model this scenario, add a script to the field evaluators of the Hierarchy attribute. You can choose between writing one in VBScript or Python script. The example below, which is in VBScript, creates a variable named level and sets it to 3 (the lowest hierarchy level in this example). Next, the following condition is set: if Func_Class is 1, 2, or 6, assign level a value of 1. If Func_Class is 3 or 4, assign level a value of 2. For all other cases, the value remains 3. The Value text box contains level so the hierarchy network attribute evaluates to the value it represents at the end of the script.

Setting hierarchy levels using a prelogic VBScript

This ensures that all elements with Func_Class 1, 2, or 6 are assigned a hierarchy value of 1; all elements with Func_Class 3 or 4 are assigned a hierarchy value of 2; and all others (namely, elements with Func_Class values of 5) are assigned a hierarchy value of 3.

LegacyLegacy:

Prior to ArcGIS 10, the Hierarchy Ranges dialog box was used to convert multiple field values into exactly three hierarchy levels. Now, however, its only purpose is to define primary, secondary, and local roads when working with a global turn delay evaluator or setting scale ranges for traffic display. This means that the Hierarchy Ranges dialog box has no effect on the hierarchy attribute of the network dataset, rather, it only affects the global turn delay evaluator.

The Hierarchy Ranges dialog box
Click Ranges on the Attributes panel to see the Hierarchy Ranges dialog box.

When a global turn delay evaluator is used with a hierarchy attribute, edges must be categorized into three classes: local, secondary, and primary roads. Since a hierarchy attribute could specify any number of hierarchy levels, the Hierarchy Ranges dialog box allows you to group those levels into exactly three road classes. This allows you to specify costs that are added by default to turning maneuvers based on road class. For example, you can add a 10-second delay to all left turns from secondary roads onto local roads and a three-second delay to all left turns from local roads onto other local roads. Many other turn combinations are possible when using road classes with the global turn delay evaluator.

Learn more about establishing global turns

Scale ranges can be set when viewing traffic so that when you are zoomed in on a map, all roads with traffic are displayed. As you zoom out, the local, secondary, then primary roads are filtered from the display. This keeps the traffic map uncluttered and shows only the road hierarchy levels that are relevant for different map scales. The scale ranges are set with respect to the hierarchy ranges you specify in the Hierarchy Ranges dialog box.

Learn more about visualizing traffic

Related Topics

7/2/2014