Similar to Ben Coakley's issue about "Function Outputs", there is practically no documentation that I can find about how to utilize the results of a trace (SELECTION option) using arcpy scripting. Basically, I want to save the selection to a layer so I can do further tracing or analysis on the derived selection. There should be an option similar to AGGREGATED_GEOMETRY which saves NON-AGGREGATED results. I don't see a rationale for aggregating geometry anyway as it produces just a single mult-part feature which seems useless to work with. Will exploding the aggregated geometry always maintain flow direction of the individual features? Even so, if there were important attributes on the original network, they would now be lost in the aggregated dissolve, which means you can't do any attribute queries or further selections on the aggregated output. By comparison, the old TraceGeometricNetwork function allowed you to work with the Group Layer output and save the results to a separate feature class with the attributes intact. I would like to see this functionality in the new Trace function (or at least the ability to save the selection with original geometry and attributes as optional output).
Solved! Go to Solution.
John Gaiot A new result type option (Network Layers) will be available in the 2.7 release to provide this type of functionality. With this result type option selected, a new group layer will be created with a name you provide. The group layer will contain a collection of sub-layers (feature layers) corresponding to network sources belonging to the trace network with trace results. The actual trace results are selected in each of these sub-layers and only layers that have trace results in them are added to the output group layer.
This should enable you to access information about the network features returned in the trace for use in other tools for iterative scripting.
John Gaiot A new result type option (Network Layers) will be available in the 2.7 release to provide this type of functionality. With this result type option selected, a new group layer will be created with a name you provide. The group layer will contain a collection of sub-layers (feature layers) corresponding to network sources belonging to the trace network with trace results. The actual trace results are selected in each of these sub-layers and only layers that have trace results in them are added to the output group layer.
This should enable you to access information about the network features returned in the trace for use in other tools for iterative scripting.
Thanks Jonathan, this sounds very promising and actually very similar to the way the older geometric network tracing functioned.
For now, I am trying to utilize the AGGREGATED_GEOMETRY option by exploding the results of my first trace and using that in a second network. But when I try to enable it, I get a 'table already exists' error, which I suspect is related to the first network I created/enabled. Details are in a more recent post I made in this forum a few days ago. When I get a chance, I may try a test of creating the second network in a brand new geodatabase to see if that works any better?
Has anyone solved this issue since the last post? I have a stand-alone Python script that I'm converting over from using a Geometric Network to the Trace Network. I can run the script from within an ArcGIS Pro project and access the results using a result type of 'NETWORK_LAYERS', but running as a stand-alone, I can't see how to access the trace results.
I've also tried using the result type of 'SELECTION', but have had no success.
I'm right there with you on the best way to access the trace results in the stand-alone python script. I've tried Selection and Network Layers that I've been running as a script tool within ArcGIS Pro toolbox.
My goal would be to have the script iterate over a few hundred starting points with a static downstream point. At the moment the tool runs and selects the section of stream within the map for just one set of starting points, but if I try and append the selection in the stand-alone script it doesn't recognize the selection and appends the entire layer. My thought was to have it iterate thru the points and append each path to an overall output layer of all paths.
I'm using Pro 3.0.3
Thanks,
Kathy
The workaround that I've implemented is to use result_types='ELEMENTS' and specify a value for the out_json_file parameter.
This outputs the selected features to a json file.
I then parse the outputted json file to extract a list of the object ids of the selected features that I want to do further processing on. The object id list is manipulated to construct a where statement that is then used in an arcpy.Select_analysis function to re-query out the features from the source layer.
It seems silly to run a trace that outputs a selection of features and then have to build a where statement to re-query the same features so that you can actually do something with the results, but it's the only way I've been able to replicate the functionality that I had with my previous script.