ArcObjects Library Reference (NetworkAnalyst)  

INAContext.NetworkDataset Property

The associated network dataset.

[Visual Basic .NET]
Public ReadOnly Property NetworkDataset As INetworkDataset
[C#]
public INetworkDataset NetworkDataset {get;}
[C++]
HRESULT get_NetworkDataset(
  INetworkDataset** NetworkDataset
);
[C++]

Parameters

NetworkDataset [out, retval]

  NetworkDataset is a parameter of type INetworkDataset

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server. Requires Network Analyst Extension.

Remarks

NetworkDataset returns the NetworkDataset that the NAContext is referencing.

The NetworkDataset is only available after the NAContext has been bound to a NetworkDataset using INAContextEdit::Bind.

[C#]

This illustrates how you can get the NetworkDataset from the NAContext after it has been bound.

public void CreateContextAndGetNetworkDatasetBackOut(INetworkDataset networkDataset)
{
  INASolver naSolver = new NARouteSolver() as INASolver;
  IDENetworkDataset deNetworkDataset = ((IDatasetComponent)networkDataset).DataElement as IDENetworkDataset;
  INAContext context = naSolver.CreateContext(deNetworkDataset, naSolver.DisplayName) as INAContext;
  INAContextEdit contextEdit = (INAContextEdit)context;
  contextEdit.Bind(networkDataset, new GPMessagesClass());
  INetworkDataset networkDatasetFromContext = context.NetworkDataset;
}

 


 

See Also

INAContext Interface

.NET Samples

Closest facility solver (Code Files: frmClosestFacilitySolver) | Location-allocation solver (Code Files: frmLocationAllocationSolver) | Network Analyst barrier location editor (Code Files: EditorForm) | Network Analyst Engine application (Code Files: frmNALayerProperties) | Origin-destination cost matrix solver (Code Files: frmODCostMatrixSolver) | Service area solver (Code Files: frmServiceAreaSolver) | Subset network evaluators (Code Files: AutoUpdateNetworkElementArrayParametersCommand SubsetHelperUI) | Vehicle routing problem solver (Code Files: frmVRPSolver) |