I am having a problem when using restrictions in basic route solving. I am attempting to make portions of the network that are inaccessible to disabled persons non-traversable in route solving. I have the attribute contained in my feature class, and it has been queried out and a new feature class containing only the non-traversable segments of the network. This has been added to the network, and assigned as a restriction evaluator. I have assigned the value as a constant, restricted. The evaluator is set as a default. In the Analysis tab, the correct restriction box is checked. When I go to solve a route though, the resulting route still traverses these sections of the network. Am I missing a fundamental aspect to using restrictions?
I am using ArcGIS 10 with Network Analyst extension.
I have the attribute contained in my feature class, and it has been queried out and a new feature class containing only the non-traversable segments of the network. This has been added to the network, and assigned as a restriction evaluator.
You should not need to create a separate feature class to represent restricted edges. This may, in fact, be your problem. For example, suppose you have a network dataset built from some source feature class A. If you selected features from feature class A, then exported them to a new feature class B, marked them as restricted in B, and added B to your network, then the edges established by feature class A would still be traversable, even though the duplicate edges in B are not traversable, which appears to be what you are seeing.
You should instead just create a field on feature class A, and then create a restriction attribute which reads this field and determines whether or not the features from feature class A are restricted. Creating a new source feature class from a subset of another source feature class will just create redundant, parallel edges. Does this make sense?
Yes, this makes complete sense. I have a field in my feature class that I have attributed a value of "1" to paths that are traversable by disabled persons, and "0" to those that are not. I am not too familiar with VB Script, though. What would be the correct syntax to set the restriction evaluator to apply an evaluation of "non-traversable" to segments with a value of "0"? The field I am using for this is [Accessible].
When setting up your restriction attribute, make sure to specify its Type as "Field" and not "Script", as the field evaluator is only evaluated once at build time (and the values are cached in a table for fast lookups at query time), whereas a true script evaluator is fully evaluated every time an element is queried (which is relatively slow). When you specify the Type = Field for your evaluator, then click the Properties button on right side of the evaluators dialog to open up the Field Evaluators dialog (here you will specify some VB script code, but this will only be evaluated once at build time).
The pre-logic script code should be something like the following:
restricted = False If [Accessible] = "0" Then restricted = True End If
The Value expression should then simply be: restricted
The code above assumes your [Accessible] field is a string field. If it is instead a numeric field, you should remove the quotes from around the 0 value above (i.e., "0" becomes just 0).