2

I am working on script that iterates through trace flags and traces upstream. For each trace flag, I have selected features from multiple layers in the geometric network that I want to act as barriers to terminate the trace. I have tried merging all of the selected features in each iteration to a single feature class, but if there is not one and only one feature at each junction (we have some points that are disconnected and coincident with connected junctions) then sometimes the disconnected feature is flagged as the barrier and the trace does not end.

I have instead made a list of layers that have selected features as barriers.

list_of_layers =['lyr1','lyr2']
arcpy.TraceGeometricNetwork_management(geomNetwork, r"outNet",traceflag ,"TRACE_UPSTREAM", list_of_layers, "", "", "", "", "NO_TRACE_ENDS", "NO_TRACE_INDETERMINATE_FLOW", "", "", "AS_IS", "", "", "", "AS_IS")

but this fails

Runtime error 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\program files (x86)\arcgis\desktop10.7\arcpy\arcpy\management.py", line 6253, in TraceGeometricNetwork
    raise e
RuntimeError: Object: Error in executing tool

An earlier comment directed me to the tool help with states that this parameter is to be feature layer, not a list of barrier layers

How might one perform an upstream trace with barrier features selected on multiple point layer?

1
  • 1
    Per the tool help, you cannot send in a list of layers for this parameter. It accepts a Feature Layer (not a list of Feature Layers). That said, this "answers" your question as you've proposed it. I'd suggest re-wording your question to "how do I use multiple layers for the trace barrier?"....or something to that affect.
    – KHibma
    Commented Feb 25, 2020 at 16:39

1 Answer 1

1

A work around:

I identified lines intersecting with my trace flag and lines intersecting with my trace barriers. I created mid-points at each of those lines and appended them to the trace flags and to the barriers, respectively, on each iteration. This DOES end up returning lines immediately downstream from the input flag, but for my purposes and with the way my data is set up this works for me.

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.