ArcObjects Library Reference (GeoDatabase)  

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,
  IEnvelope** affectedArea
);
[C++]

Parameters

areaToBuild [in]

  areaToBuild is a parameter of type IEnvelope

affectedArea [out, retval]

  affectedArea 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 must be performed outside of an edit session on shapefile or Geodatabase network datasets. During the 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.

[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

.NET Related Topics

How to create a multimodal network dataset | How to create a network dataset