This document is archived and information here might be outdated.  Recommended version.


INetworkBuild.BuildNetwork Method (ArcObjects .NET 10.7 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geodatabase > ESRI.ArcGIS.GeoDatabase > Interfaces > IN > INetworkBuild Interface > INetworkBuild.BuildNetwork Method
ArcGIS Developer Help

INetworkBuild.BuildNetwork Method

Builds the network dataset for the given extent.

[Visual Basic .NET]
Public Function BuildNetwork ( _
    ByVal areaToBuild As IEnvelope _
) As IEnvelope
[C#]
public IEnvelope BuildNetwork (
    IEnvelope areaToBuild
);
[C++]
HRESULT BuildNetwork(
  IEnvelope* areaToBuild
);
[C++]
Parameters
areaToBuild [in]

areaToBuild is a parameter of type IEnvelope*

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

BuildNetwork builds the network dataset in the area specified by the areaToValidate envelope and returns the envelope of the validated area. If an empty envelope is supplied, BuildNetwork will return an empty validated area. The simplest way to build a Network Dataset is to pass in the envelope of the extent of the network dataset. Note that the network dataset must be rebuilt when edits are made to the underlying features or feature classes. Edits include:

 

Incremental rebuilds of the network dataset are not supported in ArcGIS 9 - the entire network must be rebuilt. If any envelope other than that of the Network Dataset extent is supplied, the entire network will still be built.

Remarks

BuildNetwork can be performed inside or outside of an edit session; however, geodatabase network datasets that are registered as versioned can only be built inside of an edit session. Also, shapefile network datasets can only be built outside of an edit session.

During the build process, the connectivity of features will be determined based on the connectivity policy and group settings and the elevation fields. The attributes defined on the network dataset will be populated within the logical network. Solve operations can still be performed on Network Datasets that have been edited since they have been built, however, the results are not guaranteed to be correct.

Note that all dirty areas are rebuilt, regardless of the envelope being passed in.

[C#]

The following code can be used to build network dataset:

//It is assumed that the selected layer in ArcMap TOC is the network layer to be build
//m_application is an instance of ESRI.ArcGIS.Framework.IApplication
ESRI.ArcGIS.ArcMapUI.IMxDocument mxdoc = m_application.Document as ESRI.ArcGIS.ArcMapUI.IMxDocument; ESRI.ArcGIS.Carto.INetworkLayer netlayer = mxdoc.SelectedLayer as ESRI.ArcGIS.Carto.INetworkLayer;
//cast from INetworkDataset to INetworkBuild ESRI.ArcGIS.Geodatabase.INetworkBuild netbuild = netlayer.NetworkDataset as ESRI.ArcGIS.Geodatabase.INetworkBuild;
//cast to IGeoDataset to get the full extent envelope for network dataset ESRI.ArcGIS.Geodatabase.IGeoDataset geodataset = netlayer as ESRI.ArcGIS.Geodatabase.IGeoDataset;
//Build the network dataset ESRI.ArcGIS.Geometry.IEnvelope returnedExtent = netbuild.BuildNetwork(geodataset.Extent.Envelope);

See Also

INetworkBuild Interface