INetworkSource Interface

Provides access to members that specify the properties of a source in a network dataset.

Members

Name Description
Read/write property ElementType Network element type of this network source.
Read-only property GeometryType The enumerated geometry type.
Read-only property ID Unique identifier of this network source.
Read/write property Name Name of the class associated with this network source.
Read/write property NetworkSourceDirections The directions settings for this network source.
Read/write property Properties Property set of this network source.
Read-only property SourceType Type of network source.
Read/write property UsesGeometryInConnectivity Indicates if the source object's geometry is used in determining network connectivity.

INetworkSource.ElementType Property

Network element type of this network source.

Public Property ElementType As esriNetworkElementType
public esriNetworkElementType ElementType {get; set;}

INetworkSource.GeometryType Property

The enumerated geometry type.

Public ReadOnly Property GeometryType As esriGeometryType
public esriGeometryType GeometryType {get;}

INetworkSource.ID Property

Unique identifier of this network source.

Public ReadOnly Property ID As Integer
public int ID {get;}

Remarks

Each source in a Network Dataset is identified by a unique value, the ID property. The ID property can be used to get a reference to the corresponding network source through the INetworkDataset::SourceByID property. This ID is different than the ID value returned by the IObjectClass::ObjectClassID property.

As with ObjectID values, SourceID values are never reused. They are not guaranteed to be sequential, but are guaranteed to be in increasing order based on when the source was added to the network. Unless the source is added or deleted from the DataElement, the SourceID values will remain constant after the INetworkDataset::UpdateSchema method is called.

INetworkSource.Name Property

Name of the class associated with this network source.

Public Property Name As String
public string Name {get; set;}

Remarks

As the network source and its associated feature class (or table) have the same name, it's possible to use this mapping to retrieve the source from any given layer.

// The following code shows how to retrieve a network source based on the feature class name

int layerId = 0;



// Get the feature class associated with the specific layer

IMapServer ms = (MapServer)serverObjectHelper.ServerObject;

IMapServerDataAccess mapServerDataAccess = (IMapServerDataAccess)serverObjectHelper.ServerObject;

IMapServerInfo mapServerInfo = ms.GetServerInfo(ms.DefaultMapName);

IFeatureClass fc = (IFeatureClass)mapServerDataAccess.GetDataSource(ms.DefaultMapName, layerId);

IDataset ds = (IDataset)fc;



// Get the UN domain networks and loop through the network sources to find the one matching the feature class

IDatasetComponent dsComponent = (IDatasetComponent)unDataset;

IDEDataset dataElement = dsComponent.DataElement;

IDEBaseNetwork bnDataElement = (IDEBaseNetwork)dataElement;

IDEUtilityNetwork unDataElement = (IDEUtilityNetwork)bnDataElement;

IArray domainNetworks = unDataElement.DomainNetworks;

INetworkSource ns = null;





for (int i = 0; i < domainNetworks.Count; i++)

{

  IDomainNetwork dn = (IDomainNetwork)domainNetworks.Element[i];

  IArray networkSources = dn.Sources;

  for (int j = 0; j < networkSources.Count; j++)

  {

    INetworkSource currentNS = (INetworkSource) networkSources.Element[j];

    if(currentNS.Name == ds.Name)

    {

      ns = currentNS;

      break;

    }

  }



  if (ns != null)

    break;

}

INetworkSource.NetworkSourceDirections Property

The directions settings for this network source.

Public Property NetworkSourceDirections As INetworkSourceDirections
public INetworkSourceDirections NetworkSourceDirections {get; set;}

Remarks

The NetworkSourceDirections property specifies the information needed to generate driving directions when reporting routes traversing elements from this INetworkSource.

INetworkSource.Properties Property

Property set of this network source.

Public Property Properties As IPropertySet
public IPropertySet Properties {get; set;}

INetworkSource.SourceType Property

Type of network source.

Public ReadOnly Property SourceType As esriNetworkSourceType
public esriNetworkSourceType SourceType {get;}

INetworkSource.UsesGeometryInConnectivity Property

Indicates if the source object's geometry is used in determining network connectivity.

Public Property UsesGeometryInConnectivity As Boolean
public bool UsesGeometryInConnectivity {get; set;}

Remarks

The UsesGeometryInConnectivity property indicates whether the geometries of the features in an INetworkSource are used in determining how its network elements are connected to each other.

For example, the geometries of the features in an EdgeFeatureSource and JunctionFeatureSource are used to determine how the generated edge and junction elements connect to each other. The UsesGeometryInConnectivity property for these sources is True.

In contrast, the geometries of the features in a TurnFeatureSource are not used in deteriming how the turn elements are associated with the edges and junctions of the network -- the fields of the TurnFeatureSource feature class determine this. The UsesGeometryInConnectivity property for the TurnFeatureSource is False.

Classes that implement INetworkSource

Classes Description
EdgeFeatureSource A container for describing a network dataset source whose edge elements are derived from line feature geometry.
JunctionFeatureSource A container for describing a network dataset source whose junction elements are derived from point feature geometry.
TurnFeatureSource A container for describing a network dataset source whose elements are derived from turn feature geometry.

Remarks

The INetworkSource interface is used to access the properties of the network source, such as its name and source type.

To access the INetworkSource object for an existing network dataset source, use the Source, SourceByID, or SourceByName methods on the INetworkDataset interface.

The INetworkSource interface is also used to define a new network source. To create a new network source, cocreate the appropriate NetworkSource object, specify its properties, and pass the object to the INetworkBuild::AddSource method on the network dataset.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.