ESRI Network Layer CoClass.
Product Availability
Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.
Interfaces
Interfaces | Description |
---|---|
IConnectionPointContainer | Supports connection points for connectable objects. |
IDataLayer | Provides access to members that control the data source properties of a layer. |
IDataLayer2 | Provides access to additional members that control the data source properties of a layer. |
IDataset (esriGeoDatabase) | Provides access to members that supply dataset information. |
IDisplayAdmin (esriDisplay) | Provides access to members that control display administration. |
IDisplayFilterManager (esriDisplay) | Provides access to members that control display filter management. |
IGeoDataset (esriGeoDatabase) | Provides access to members that provide information about a Geographic Dataset. |
IIdentify | Provides access to members that identify features. |
IIdentify2 | Provides access to members that set the current scale of the display. |
ILayer | Provides access to members that work with all layers. |
ILayer2 | Provides access to additional members that work with all layers. |
ILayerDrawingProperties | Provides access to members that control layer drawing properties. |
ILayerEffects | Provides access to members that control layer effects. |
ILayerExtensions | Provides access to the extensions of a layer. |
ILayerGeneralProperties | Provides access to layer general properties. |
ILayerInfo | Provides access to members that return layer images. |
ILayerPosition | Provides access to members that control a layer's default position in the map interface. |
ILegendInfo | Provides access to members that control legend information provided by a renderer. |
IMapLevel (esriDisplay) | Provides access to members that control the map level. |
INetworkLayer | Provides access to members that control a network layer. |
INetworkRendererCollection | Provides access to members that manage the collection of network renderers. |
IPersistStream (esriSystem) | |
IPropertySupport (esriSystem) | Provides access to members that set a default property on an object. |
IPublishLayer | Provides access to a layer's capability for being published with the ArcGIS Publisher extension. |
ITimeData | Provides access to time related properties of a layer. |
ITimeDataCustomUI | Provides access to interface that indicates if a layer has a associated UI of its own. |
ITimeDataDisplay | Provides access to time animation related properties of a layer. |
Event Interfaces
Interfaces | Description |
---|---|
ILayerEvents (default) | Provides access to events that occur when layer visibility changes. |
Remarks
The NetworkLayer is a type of Layer in the Map that holds a reference to a NetworkDataset. You can open its network dataset by calling INetworkLayer::NetworkDataset.
[C#]
The following code shows how to open a shapefile network dataset, then add it to a Map using a NetworkLayer:
void AddNetworkLayer(string shapefilePath, string networkDatasetName, IMap map)
{
IWorkspaceFactory workspaceFactory = new ShapefileWorkspaceFactoryClass() as IWorkspaceFactory;
IWorkspace workspace = workspaceFactory.OpenFromFile(sShapefilePath, 0);
IWorkspaceExtensionManager wsExtMgr = workspace as IWorkspaceExtensionManager;
UID myUID = New UIDClass();
myUID.Value = "esriGeoDatabase.NetworkDatasetWorkspaceExtension";
IWorkspaceExtension wsExt = wsExtMgr.FindExtension(myUID);
IDatasetContainer2 dsCont = wsExt as IDatasetContainer2;
IDataset dataset = dsCont.DatasetByName(esriDTNetworkDataset, networkDatasetName)
INetworkDataset networkDataset = dataset as INetworkDataset;
INetworkLayer networkLayer = New NetworkLayerClass();
networkLayer.NetworkDataset = networkDataset;
map.AddLayer(networkLayer);
}
[Visual Basic .NET]
The following code shows how to open a shapefile network dataset, then add it to a Map using a NetworkLayer:
Sub AddNetworkLayer(shapefilePath As String, networkDatasetName As String, map As IMap)
Dim workspaceFactory As IWorkspaceFactory = New ShapefileWorkspaceFactory
Dim workspace As IWorkspace = workspaceFactory.OpenFromFile(sShapefilePath, 0)
Dim wsExtMgr As IWorkspaceExtensionManager = CType(workspace, IWorkspaceExtensionManager)
Dim myUID As New UID
myUID.Value = "esriGeoDatabase.NetworkDatasetWorkspaceExtension"
Dim wsExt As IWorkspaceExtension = wsExtMgr.FindExtension(myUID)
Dim dsCont As IDatasetContainer2 = CType(wsExt, IDatasetContainer2)
Dim dataset As IDataset = dsCont.DatasetByName(esriDTNetworkDataset, networkDatasetName)
Dim networkDataset As INetworkDataset = CType(dataset, INetworkDataset)
Dim networkLayer As INetworkLayer = New NetworkLayer
networkLayer.NetworkDataset = networkDataset
map.AddLayer(networkLayer)
End Sub
Working with Events
[Visual Basic 6.0]
When working with NetworkLayer's default outbound interface in Visual Basic 6 declare variables as follows: Private WithEvents pNetworkLayer as NetworkLayer