Solved! Go to Solution.
Here is a code sample with documentation
Hello Shriram,
I am already using it:
ITraceFlowSolverGEN pTraceFlowSolver = new TraceFlowSolverClass() as ITraceFlowSolverGEN;
pTraceFlowSolver.FindFlowElements(strTraceType, esriFlowElements.esriFEJunctionsAndEdges, out pJunctionEIDs, out pEdgeEIDs);
It seems like it always returns the result of a Connected trace, no matter which trace method I specify.
I have a test network that consists of a source (a reservoir), a sink (water meter) water hydrant and two pipes.
Every time i get all the junctions returned, but only when I set the flag
pTraceFlowSolver.TraceIndeterminateFlow = true;
Otherwise, I only get the trace starting junction.
Could this be a matter of weights?
I am using default net solver weights...
Do You have a working example of net solver weights usage?
Tnx in advance.
So I think I know what the issue is:
My network does not have Flow Direction initialized.
I suppose that this is why up/downstream traces do not work.
Actually, I do not need this, because my app is supposed to return nearest upstream and nearest downstream node of a selected node.
All my features have a weight field, which is initialized to 32768 for sources and 65536 for sinks.
Any idea how can I determine if a neighbour node is upstream or downstream?
It occured to me to use FindConnected trace and then find all the sinks, and sources, and determine the nearest ones.
But I cannot figure out if the node is up or downstream ![]()
Inizialized Flow Direction if you need downstream or upstream
you can use similiar code for find edge in downstream or upstream with your business logic.
 INetTopologyEditGEN netTopology = networkElements as INetTopologyEditGEN;
                            int edgeCount = netTopology.GetAdjacentEdgeCount(yourEIDJunction);
                            bool reverseOrientation;
                            int adjacentEdge;
                            for (int i = 0; i < edgeCount; i++)
                            {
                                netTopology.GetAdjacentEdge(yourEIDJunction, i, out adjacentEdge, out reverseOrientation);
                              
                                netTopology.GetFromToJunctionEIDs(adjacentEdge, out fromEIDJunction, out toEIDJunction);
reverseOrientation = true // into Junction -> upstream
reverseOrientation = false // exit Junction -> downstream
Hello Domenico,
Works great, thanks.
Thanks a lot.
Just one question:
Does this relay on the NetworkAncilarryRole Field (determines flow according to the Source/Sink value of the junction) ?
Because if it relies on that, it will not work for me.
I need nearest adjacent junctions on the up and downstream side, but according to NetWeight field.
Could I use IForwardStarGEN interface:
It seems to have methods that take notice of weights...
Tnx again.
Yes, it 's similar INetTopologyEditGen  but with IForwardStarGEN you have also the weight!![]()