Using parameters with network attributes
Network attribute values sometimes depend on variable conditions. For example, a vehicle's height can determine if a road segment with a low overpass is traversable or not. Present weather conditions may scale down travel speeds and thus affect network time costs. You can model restrictions based on vehicle height, travel costs based on scale factors, and other variable aspects of network analysis with one of two approaches. One method is to create a network attribute for every variation in height or weather condition; however, this approach doesn't scale as the number of permutations grows. A more versatile approach is to use a single network attribute with a parameter that contains the variable aspect of the attribute.
Parameters are placeholders for values that are specified later. They each have a default value in case a new value is not assigned. In ArcCatalog, parameters are added to network attributes and referenced by the attribute's evaluators. The parameter values can be changed in ArcMap when setting up network problems so that the values of the network attribute can be determined at runtime using the expression and the current parameter value.
How parameterized network attributes work
A parameterized network attribute has either a VBScript or function evaluator that makes use of a parameter on the network attribute as well as another network attribute to help determine its value. Because the parameters may change at runtime, their values are not written to the database; rather, they are only computed on demand. Consequently, the network dataset doesn't need to be rebuilt when the parameter value changes.
Parameters on restriction attributes
You can add parameters on restriction attributes to determine which network elements can be used by a vehicle. The parameter holding a vehicle characteristic is compared with a value coming from a descriptor attribute to determine whether the network element is traversable. For example, a parameterized restriction attribute can compare the height of your vehicle with a descriptor attribute that holds the clearance under overpasses or through tunnels. If the vehicle height is greater than the clearance, the edge is restricted. This can result in different routes for different vehicles: as illustrated below; a short vehicle might follow a direct route under a low bridge, whereas a tall vehicle would take a different route that avoids the low clearance.
In such a scenario, you might create two attributes: a descriptor attribute and a restriction attribute, perhaps respectively naming them MaxHeight and HeightRestriction. MaxHeight would pull in clearance values from the source data, and HeightRestriction would read the values from MaxHeight and compare them with a parameter holding the current vehicle height. The diagram below shows a generalized version of this process.
Parameters on cost attributes
You might instead want a parameterized cost attribute that can reference another cost attribute and scale it. This is useful when inclement weather, like ice, fog, or heavy rain, descends on your study area and hinders the normal flow of traffic. By having a parameter already outfitted on a cost attribute, you can adjust travel-time expectations to correspond with changes in traffic speeds.
You could create two network attributes: DriveTime, to store the normal drive-time impedances with values coming from fields in your source data, and DriveTime_scaled, to take the DriveTime attribute value and scale it by a parameter on the DriveTime_scaled attribute that holds the current scale factor.
Setting up a parameterized attribute
Once you have created the necessary network attributes, you can set up the parameterized attribute, which consists of two primary steps:
- Add a parameter to a network attribute.
- Set up the attribute's evaluator to use the parameter.
These steps are carried out in ArcCatalog using the Attributes tab of the Network Dataset Properties dialog box.
Adding a parameter
You can follow the next steps to create a parameter. The example below is tailored for a restriction attribute, HeightRestriction, but the same procedure works for cost attributes.
A new parameter, Vehicle Height, is added to the HeightRestriction attribute and assigned a default value of zero. (With a vehicle height of zero, it is assumed the vehicle can fit under any clearance.) You can change the parameter's value from its default when you perform a network analysis in ArcMap.
Setting up the evaluator
After the parameter is added, you need to design an evaluator that incorporates the parameter and either a constant or another network attribute that stores information related to the parameter. In the example below, the parameterized restriction attribute, HeightRestriction, is assigned an evaluator that will compare the Vehicle Height parameter with the descriptor network attribute, MaxHeight, which contains the clearance measurements for network elements.
Since the VBScript evaluator calculates its values at the time of analysis using the VBScript environment, specifying this evaluator tends to negatively affect the analysis performance. ESRI strongly recommends using the function evaluator instead of the VBScript evaluator when possible for best performance during analysis.
The function evaluator was chosen for this example. The Function Evaluators dialog box below shows the expression that is evaluated for each street. Anytime the function evaluator returns True, the network element is restricted. If it returns False, the network element is traversable and can be used in the solution.
For the sake of comparison, a parameterized cost attribute, DriveTime_scaled, was set up with a function evaluator (shown below) that makes use of the DriveTime Factor parameter. The evaluator reads the drive time from the DriveTime cost attribute and multiplies it by the value of the DriveTime Factor, which is specified at run time.
You can change the parameter at run time from its default value of 1. A value of 1.5 would slow drive times by 50 percent of their normal times. A network element with a DriveTime value of 5 minutes would have a DriveTime_scaled value of 7.5 minutes.
Rebuilding the network dataset
Since function evaluators don't store their values in the database but rather compute them at run time, it is not necessary to rebuild your network dataset after adding or modifying a function evaluator or corresponding attribute parameters within ArcCatalog. However, if you make changes to its related attribute based on a field evaluator, you need to rebuild the network dataset to make use of the new values.
With the parameterized attribute prepared in ArcCatalog, you can begin using it to solve network problems in ArcMap. When you change the value of the parameter from its default, there isn't a need to rebuild the network.