Provides access to the results of an analysis.
| Description | ||
|---|---|---|
![]() |
ElementIDFieldName | The element ID field name. |
![]() |
FeatureClass | The feature class by element type. |
![]() |
FromEdgeIDFieldName | The from edge ID field name. |
![]() |
FromJunctionIDFieldName | The from junction ID field name. |
![]() |
FromPositionFieldName | The from position field name. |
![]() |
SearchConnected | Returns a connected set of elements in the result. |
![]() |
SourceIDFieldName | The source ID field name. |
![]() |
SourceOIDFieldName | The source OID field name. |
![]() |
ToEdgeIDFieldName | The to edge ID field name. |
![]() |
ToJunctionIDFieldName | The to junction ID field name. |
![]() |
ToPositionFieldName | The to position field name. |
| CoClasses and Classes | Description |
|---|---|
| NATraversalResult | Contains the result of a network analysis. |
The INATraversalResultQuery interface is used to navigate through the traversal result and to provide the field names for various fields on the traversal classes.
You can use the properties ending with "FieldName" to get the fields holding the information about what the NATraversalResultElement is referencing. Here is a description about what each field holds:
Use the FeatureClass property to return a feature class holding all the NATraversalResultElements of a specific type (esriNETJunction, esriNETEdge, esriNETTurn). This feature class can be accessed like any other feature class in ArcGIS.
Use the SearchConnected method to return the NATraversalResultElements that are connected to the input NATraversalResultElement.
This C# example shows how you can add a feature class returned by the FeatureClass property on INATraversalResultQuery to a map.
public void AddNATraversalResultToMap(INALayer naLayer, IMap map)
{
INATraversalResultQuery traversalResultQuery = naLayer.Context.Result;
INATraversalResultEdit naTraversalResultEdit = traversalResultQuery as INATraversalResultEdit;
// Infer Geometry
naTraversalResultEdit.InferGeometry(string.Empty, null, new CancelTrackerClass());
// Get the Edges and add as a layer
IFeatureLayer featureLayer = new FeatureLayerClass();
featureLayer.FeatureClass = traversalResultQuery.get_FeatureClass(esriNetworkElementType.esriNETEdge);
featureLayer.Name = featureLayer.FeatureClass.AliasName;
map.AddLayer(featureLayer);
// Get the Junctions and add as a layer
featureLayer = new FeatureLayerClass();
featureLayer.FeatureClass = traversalResultQuery.get_FeatureClass(esriNetworkElementType.esriNETJunction);
featureLayer.Name = featureLayer.FeatureClass.AliasName;
map.AddLayer(featureLayer);
}
This Visual Basic example shows how you can add a feature class returned by the FeatureClass property on INATraversalResultQuery to ArcMap.
Public Sub AddNATraversalResultToArcMap()
Dim pMxDoc As IMxDocument
Dim pNetworkAnalystExtension As INetworkAnalystExtension
Dim pNALayer As INALayer
Dim pFLayer As IFeatureLayer
Dim pTraversalResultQuery As INATraversalResultQuery
Dim pNATraversalResultEdit As INATraversalResultEdit
Set pMxDoc = ThisDocument
Set pNetworkAnalystExtension = Application.FindExtensionByName("Network Analyst")
Set pNALayer = pNetworkAnalystExtension.NAWindow.ActiveAnalysis
Set pTraversalResultQuery = pNALayer.Context.Result
Set pNATraversalResultEdit = pTraversalResultQuery
'Infer Geometry
pNATraversalResultEdit.InferGeometry "", Nothing, New CancelTracker
'Get the Edges and add as a layer
Set pFLayer = New FeatureLayer
Set pFLayer.FeatureClass = pTraversalResultQuery.FeatureClass(esriNETEdge)
pFLayer.Name = pFLayer.FeatureClass.AliasName
pMxDoc.FocusMap.AddLayer pFLayer
'Get the Junctions and add as a layer
Set pFLayer = New FeatureLayer
Set pFLayer.FeatureClass = pTraversalResultQuery.FeatureClass(esriNETJunction)
pFLayer.Name = pFLayer.FeatureClass.AliasName
pMxDoc.FocusMap.AddLayer pFLayer
End Sub
This VB.NET example shows how you can add a feature class returned by the FeatureClass property on INATraversalResultQuery to a map.
Public Sub AddNATraversalResultToMap(ByVal naLayer As INALayer, ByVal map As IMap)
Dim traversalResultQuery As INATraversalResultQuery = naLayer.Context.Result
Dim naTraversalResultEdit As INATraversalResultEdit = traversalResultQuery ' Infer Geometry
naTraversalResultEdit.InferGeometry(String.Empty, Nothing, New CancelTracker()) ' Get the Edges and add as a layer
Dim featureLayer As IFeatureLayer = New FeatureLayer()
featureLayer.FeatureClass = traversalResultQuery.FeatureClass(esriNetworkElementType.esriNETEdge)
featureLayer.Name = featureLayer.FeatureClass.AliasName
map.AddLayer(featureLayer) ' Get the Junctions and add as a layer
featureLayer = New FeatureLayer()
featureLayer.FeatureClass = traversalResultQuery.FeatureClass(esriNetworkElementType.esriNETJunction)
featureLayer.Name = featureLayer.FeatureClass.AliasName
map.AddLayer(featureLayer)
End Sub