How to create Geometric Network within a Geodatabase

Discussion created by ehallander on Sep 1, 2011
I am working with 10.0 and a 9.3 created File Geodatabase that contains a FeatureDataset with a FeatureClass of of simpleEdges and a built Network Dataset.

The goal is to create a Geometric Network using the ILoaderNetwork2 interface in Java

So, I

1) Created a new File Geodatabase and Feature Dataset.

2) I imported the FeatureClass that contains the geometries, and the Juntions table that appears to be a result of building the Network Dataset. I think at this point it is fair to say that my newly created File Geodatabase is in the 10.0 format.

3) I then followed the instructions in to see if I could do this programatically.

The link above is to the 10.0 Manual, yet when I attempt to execute the line


I find that this method does not exist and I seem to need the setFeatureDatasetNameByRef call for which I built an IDatasetName object as a FeatureDatasetName object with the WorkspaceName reference being set correctly.

Other than that I followed the example as written, preserving enabled values, ignoring the source info, and not adding any weights.

Let's say I want the new Geometric Network to have the name 'Network'.

I run this and I get the following:

SEVERE: Exception: Code 2147746833, Source: ESRI GeoDatabase, Description: The table was not found. [Network_Junctions]
AutomationException: 0x80040411 - The table was not found. [_Junctions] in 'ESRI GeoDatabase'
at com.esri.arcgis.networkanalysis.NetworkLoader.loadNetwork(Unknown Source)

Which complains about the table Network_Junctions being not found. Pretty sure this is supposed to get created.

If I use ArcCatalog and select the NetworkFeature Dataset and New->Geometric network and follow the same basic steps, and execute, it succeeds (with some edge errors), thus creating the 'Network' Geometric Network, and a 'Network_Junctions' FeatureClass with all the junctions.

So I am guessing that the networkLoader.loadNetwork() method should be responsible for getting this all created.

What simple concept (Realizing that there are of course no simple concepts in this package) am I missing here? I am having trouble finding a reference to this error allowing me to see where others have failed.


PS. The basic code structure is

   private void buildGeoNetwork(FeatureDataset fDataset, IDatasetName idn, String networkName) {
    try {
  INetworkLoader2 networkLoader2 = new NetworkLoader();
  IFeatureClass[] fclasses = extractFeatureClasses(fDataset);
  for (int i=0; i<fclasses.length; i++)
   int fccVal = networkLoader2.canUseFeatureClass(fclasses[i].getAliasName());
   if ( fccVal == esriNetworkLoaderFeatureClassCheck.esriNLFCCValid)
    logger.debug("Adding Feature Class " + fclasses[i].getAliasName());
       networkLoader2.addFeatureClass(fclasses[i].getAliasName(), fclasses[i].getFeatureType(), null,
    logger.warn("Unable to use Feature Class " + fclasses[i].getAliasName() + "[" + EsriNLFCHelper.decode(fccVal) + "]");

I build up my DatasetName as

IWorkspaceName wsn = new WorkspaceName();
wsn.setPathName(ws.getPathName()); // Where ws is my current open workspace
wsn.setBrowseName(ws.getBrowseName()); // Just filling it all out
IDatasetName fsn = new FeatureDatasetName();
fsn.setName(fDataset.getName()); // where fDataset is my Feature Data Set.

buildGeoNetwork(fDataset, fsn, NetworkName);