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.
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: com.vfsd.fcs.pps.vgp.tools.esri.common.EsriGeoNetwork.buildGeoNetwork:Automation 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) at com.vfsd.fcs.pps.vgp.tools.esri.common.EsriGeoNetwork.buildGeoNetwork(EsriGeoNetwork.java:525)
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.
Thanks Eric
PS. The basic code structure is
private void buildGeoNetwork(FeatureDataset fDataset, IDatasetName idn, String networkName) { try { INetworkLoader2 networkLoader2 = new NetworkLoader(); networkLoader2.setNetworkName(networkName); networkLoader2.setNetworkType(esriNetworkType.esriNTUtilityNetwork); networkLoader2.setFeatureDatasetNameByRef(idn); networkLoader2.setPreserveEnabledValues(true); networkLoader2.setSnapTolerance(networkLoader2.getMinSnapTolerance()); IFeatureClass[] fclasses = extractFeatureClasses(fDataset); for (int i=0; i<fclasses.length; i++) { int fccVal = networkLoader2.canUseFeatureClass(fclasses.getAliasName()); if ( fccVal == esriNetworkLoaderFeatureClassCheck.esriNLFCCValid) { logger.debug("Adding Feature Class " + fclasses.getAliasName()); networkLoader2.addFeatureClass(fclasses.getAliasName(), fclasses.getFeatureType(), null, false); } else { logger.warn("Unable to use Feature Class " + fclasses.getAliasName() + "[" + EsriNLFCHelper.decode(fccVal) + "]"); } } networkLoader2.loadNetwork(); . .
I build up my DatasetName as
IWorkspaceName wsn = new WorkspaceName(); wsn.setWorkspaceFactoryProgID(FileGDBWorkspaceFactory.getClsid()); 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.setWorkspaceByRef(wsn); fsn.setName(fDataset.getName()); // where fDataset is my Feature Data Set.