How to use
See How to use ArcGIS samples for help on compiling, setting up the debugger, and running the sample.
Data has been provided for your use with this sample. It can be found at
<Your ArcGIS Developer Kit Install directory>/Samples/data/SanFrancisco/SanFrancisco.gdb/Transportation/Streets_ND.
If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders.
However, you will need to update the sample to point to the location of the data once you have extracted all the files.
Installation
- Start Visual Studio.
- Rebuild the SubsetNetworkEvaluators solution.
Editing the network dataset to use subset network evaluators in ArcCatalog
- Start ArcCatalog using an ArcView or higher license and check out a Network Analyst license to enable network dataset schema updates.
- Right-click the Streets_ND network dataset in the SanFrancisco.gdb/Transportation dataset in the SanFrancisco folder and choose Add Subset Attributes to add new attributes that have parameters and are assigned the new custom evaluators (this can also be done manually by using the property page).
- If you decide to uninstall these sample subset evaluators, choose Remove Subset Attributes on any network dataset that has added them. Otherwise, the network dataset will not open because it cannot instantiate these custom evaluators. Alternatively, you can manually remove or edit any attributes that use these evaluators using the property page.
Using the auto update EID array parameters command in ArcMap
- Close ArcCatalog.
- Start ArcMap with a new document and add the Streets_ND network dataset in the SanFrancisco.gdb/Transportation dataset in the SanFrancisco folder. When prompted, add the feature classes to use the feature selection.
- Ensure a Network Analyst license is checked out and the Network Analyst toolbar is open.
- On the Network Analyst drop-down command, choose the New Route command.
- On the Analysis Settings property page of the new Route NALayer, set the ScaleSubset_Minutes attribute as the impedance attribute, then select the FilterSubset restriction.
- On the Attribute Parameters property page of the new Route NALayer, the parameters were automatically added. On the ScaleSubset_Minutes attribute, the ScaleSubset_Factor parameter value defaults to 1. In this case, use these polygons as slowdown polygons in areas of severe congestion. Therefore, to slowdown elements within slowdown polygons by a factor of 5, type 5 for the parameter value. Also, notice the *_eids_* parameters on the Attribute Parameters property page. These are the network parameters that are automatically updated if the AutoUpdateNetworkElementArrayParametersCommand command is toggled on. These arrays can also be manually set by typing in the list on this property page or other programmatic means.
- Add two or more stops to the new route and solve.
- In ArcMap, click Customize --> Custom Mode. On the Customize dialog box, click the Commands tab and the Network Analyst Samples category, then add the AutoUpdateNetworkElementArrayParametersCommand to the Network Analyst toolbar.
- Click the command to toggle on the auto update subset parameters, and toggle off to stop listening to selection change and graphic element change events.
- Select some street features, including some streets overlapping the previously solved route. Solve again. Since the AutoUpdateNetworkElementArrayParametersCommand is toggled on and you are using the FilterSubset restriction attribute for this NALayer, the selected features update the subset parameters to restrict the network elements corresponding to the selected features. The path should not go on the selected features, or if you selected too many streets, the path might not be traversable.
- Clear the selection and solve again. The path should go back to the original path.
- On the Drawing toolbar's drawing drop-down command, click Default Symbol Properties and change the symbol to have a hollow or hatched fill symbol so you can see through polygon graphic elements added to ArcMap.
- Using one of the polygon drawing tools, such as New Polygon on the drawing toolbar, digitize in one or more polygons in the vicinity of the path or stops, and resolve the route.
- Solve again and the route might change. If it did not change, increase the scale factor or add larger slowdown polygon graphic elements. Unlike the filter scale evaluator, if necessary, the route can still traverse elements in the subset.
- Toggling off the AutoUpdateNetworkElementArrayParametersCommand clears the EID array parameters and stops listening for selection or graphic element changes.
SubsetNetworkEvaluators\FilterSubsetEvaluator.cs | Filter subset evaluator restricts a subset of network elements, for example, the elements corresponding to the selected features. |
SubsetNetworkEvaluators\ScaleSubsetEvaluator.cs | Scale subset evaluator scales a subset of elements from another cost attribute by a slowdown factor parameter value. Subset could be identified by slowdown polygon graphic elements. |
SubsetNetworkEvaluators\SubsetHelper.cs | Utility class for shared functionality used by both subset evaluators for setting up and evaluating attributes that use these evaluators. |
SubsetNetworkEvaluatorsUI\AddSubsetAttributesCommand.cs | ArcCatalog network dataset context menu item used to automatically add network attributes setup to use these new evaluators to the context network dataset. |
SubsetNetworkEvaluatorsUI\RemoveSubsetAttributesCommand.cs | ArcCatalog network dataset context menu item used to automatically remove network attributes setup to use these new evaluators from the context network dataset. |
SubsetNetworkEvaluatorsUI\AutoUpdateNetworkElementArrayParametersCommand.cs | ArcMap command used to automatically toggle synchronization of subset parameters based on feature selected and slowdown polygon graphic element edit events. |
SubsetNetworkEvaluatorsUI\FilterSubsetEvaluatorEditor.cs | Registered evaluator editor used to support interactive assignment, editing, and property inspection of filter subset evaluator network attribute assignments in ArcCatalog network dataset property pages. |
SubsetNetworkEvaluatorsUI\ScaleSubsetEvaluatorEditor.cs | Registered evaluator editor used to support interactive assignment, editing, and property inspection of scale subset evaluator network attribute assignments in ArcCatalog network dataset property pages. |
SubsetNetworkEvaluatorsUI\SimpleEvaluatorProperties.cs | Evaluator properties dialog box used to summarize the properties of a subset evaluator from the Evaluators dialog box of the Network Attributes Property page in ArcCatalog. |
SubsetNetworkEvaluatorsUI\SubsetHelperUI.cs | Utility class for shared functionality used by both subset evaluators for managing parameter EID arrays. |
SubsetNetworkEvaluators\FilterSubsetEvaluator.vb | Filter subset evaluator restricts a subset of network elements, for example, the elements corresponding to the selected features. |
SubsetNetworkEvaluators\ScaleSubsetEvaluator.vb | Scale subset evaluator scales a subset of elements from another cost attribute by a slowdown factor parameter value. Subset could be identified by slowdown polygon graphic elements. |
SubsetNetworkEvaluators\SubsetHelper.vb | Utility class for shared functionality used by both subset evaluators for setting up and evaluating attributes that use these evaluators. |
SubsetNetworkEvaluatorsUI\AddSubsetAttributesCommand.vb | ArcCatalog network dataset context menu item used to automatically add network attributes setup to use these new evaluators to the context network dataset. |
SubsetNetworkEvaluatorsUI\RemoveSubsetAttributesCommand.vb | ArcCatalog network dataset context menu item used to automatically remove network attributes setup to use these new evaluators from the context network dataset. |
SubsetNetworkEvaluatorsUI\AutoUpdateNetworkElementArrayParametersCommand.vb | ArcMap command used to automatically toggle synchronization of subset parameters based on the feature selected and slowdown polygon graphic element edit events. |
SubsetNetworkEvaluatorsUI\FilterSubsetEvaluatorEditor.vb | Registered evaluator editor used to support interactive assignment, editing, and property inspection of filter subset evaluator network attribute assignments in ArcCatalog network dataset property pages. |
SubsetNetworkEvaluatorsUI\ScaleSubsetEvaluatorEditor.vb | Registered evaluator editor used to support interactive assignment, editing, and property inspection of scale subset evaluator network attribute assignments in ArcCatalog network dataset property pages. |
SubsetNetworkEvaluatorsUI\SimpleEvaluatorProperties.vb | Evaluator properties dialog box used to summarize the properties of a subset evaluator from the Evaluators dialog box of the Network Attributes property page in ArcCatalog. |
SubsetNetworkEvaluatorsUI\SubsetHelperUI.vb | Utility class for shared functionality used by both subset evaluators for managing parameter EID arrays. |
Download the files for all languages
See Also:
Programming with Network AnalystWhat is Network Analyst?
What is a network dataset?
Geodatabase
About the Network Analyst tutorial
NetworkAnalyst
Network Analyst Object Model Diagram
An overview of the network analyst toolbox
Development licensing | Deployment licensing |
---|---|
ArcView: Network Analyst | ArcView: Network Analyst |
ArcEditor: Network Analyst | ArcEditor: Network Analyst |
ArcInfo: Network Analyst | ArcInfo: Network Analyst |