I did a network analysis with ITraceFlowSolverGEN and the method FindFlowElements(). Then I did a queryId's with INetElements which returns the FeatureClassId and OID. Now I want to get the FeatureClass Or FeatureLayer or anything that I can get the shape of the object.

  • Did you manage to solve your problem? Nov 11, 2015 at 23:08
  • Well, Yes, but I found another way to do that because I Did not know how to create INetworkAnalysisExt. Thanks anyway Farid. Nov 14, 2015 at 5:47
  • If you had asked I would tell you how to get a handle of INetworkAnalysisExt! I will update my answer Nov 14, 2015 at 12:33
  • Thank you Farid , I had to do it very fast ...but I would appreciate if you do that. Nov 14, 2015 at 12:52

2 Answers 2


Here is the snippet:

IApplication app = ...
UID uidUtilNet = new UIDClass() { Value = "esriEditorExt.UtilityNetworkAnalysisExt" };
var m_utilNetExt = app.FindExtensionByCLSID(uidUtilNet) as IUtilityNetworkAnalysisExt;
nax = m_utilNetExt as INetworkAnalysisExt;

for (int i = 0; i < nax.FeatureLayerCount; i++)
    IFeatureLayer featureLayer = nax.get_FeatureLayer(i);
    if (featureLayer == null)
        logger.log.Info("null feature layer,i=" + i.ToString());
    IFeatureClass featClass = featureLayer.FeatureClass;
    if (featClass.FeatureClassID == classID)
        if (featClass.HasOID)
            var feat = featClass.GetFeature(objID);
            //do something with  feat.Shape

I did it like this.


IEnumLayer oLayers = ClsShare.GMapDocument.Map[0].get_Layers(null, true);

    ILayer[] ListOfLayers = new ILayer[200];
                    IFeatureLayer Ifl;
                    int FeatureClassId;
    while ((oLayer = oLayers.Next()) != null)
                      var Type = oLayer.Valid;
                        if (Type)
                            Ifl = oLayer as IFeatureLayer;
                            FeatureClassId = Ifl.FeatureClass.FeatureClassID;
                            ListOfLayers[FeatureClassId] = oLayer;
                        else { continue; }

So I have all the layers in an array and dont need to loop through the layers for every query i make.

  • This is similar to my answer, except that you have looped through map layers instead of network analysis layers. This should work too, although one problem may occur. what if your network layer is not present in your map! e.g. a user has removed a layer that is part of a geometric network from the map. Then you can not find the corresponding layer. Nov 14, 2015 at 12:37
  • well...Removing the layers is not an option in my web application. Nov 15, 2015 at 6:41
  • I suppose you are using the old web adf api which is deprecated! @Arvin, consider marking the correct answer per tour Nov 15, 2015 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.