Obtaining INetworkSource from Edge EID - ArcObjects C#

1107
2
03-09-2019 08:32 PM
Muhammad_TayyabMir
New Contributor II

I have  a Geometric Network of electric dataset and I'm working on a downstream trace addin using Forward Star.

While tracing, I need to obtain an extra attribute ("Feeder ID") from the source of my geometric network, which is not present in the network attributes.

So far, I have the EID of the Edge, and its geometry, during the trace iteration.

fStar.QueryAdjacentEdges(ref adjEdgeEIDS, ref adjRevOrientations, ref adjEdgeWeights);

for (int i = 0; i < adjEdgeCount; i++)
      {

         int connectedEdgeEID = adjEdgeEIDS;

         IGeometry edgeGeom =(IGeometry) _geomNet.get_GeometryForEdgeEID(connectedEdgeEID);

         // Get source of Edge EID to get FeederID Attribute

      }

Now, I have researched a little and found out that this will be achieved through INetworkSource.
I can obtain SourceID and SourceOID from the INetworkElement of that edge.

What I am unable to figure out is that how to obtain the corresponding NetworkElement from the EID or Goemetry of the Edge I have.

I hope I am going in the right direction. Any help would be appreciated.
Note: I do not have the Network Analyst Extension. I need to do it without needing the Network analyst extension.

0 Kudos
2 Replies
JoeHershman
MVP Regular Contributor

IForwardStar has a Network property of type INetwork.  INetwork casts to IDataset.  IDataset has a Workspace property and from there you can get to any FeatureTable you want and Query.  INetElements on Network object can get you the class id associated to an EID.

The thing is, as soon as you go off to get the Feeder ID you have lost the performance gains of using the ForwardStar.  Caching what you need and going off in the end to get the feature information will perform better.  Also if you are using ArcFM, I would look into trying to use one of their traces, this will perform better and I think give easier access to Feeder ID

Thanks,
-Joe
Muhammad_TayyabMir
New Contributor II

Thanks alot Joe! this is exactly what I needed.
About using ArcFM, that really was my first approach. I spent 2 weeks understanding the documentation and doing it through Downstream Trace but I got stuck very bad. I asked a couple on questions on GIS Stack Exchange which no one answered and I did not have a Schneider account to post on their forum. After two weeks I gave up and did it with Forward Star, since my deadline was reaching. 
Will surely go back to that method once I complete it for now.

0 Kudos