I would like to use Trace with result_types=['NETWORK_LAYERS']. I am unable to drill the layers in out_network_layer.
Here is an example of an attempt:
out_netk_layer = "out_net_lay"
stream_layer_name = 'Stream'
res = arcpy.tn.Trace(in_trace_network=t_network,
trace_type="SHORTEST_PATH",
starting_points=starting_points,
shortest_path_network_attribute_name="Shape length",
validate_consistency="VALIDATE_CONSISTENCY",
result_types=['NETWORK_LAYERS'],
out_network_layer=out_netk_layer)
if res:
total_length = 0
feature_class_path = '{}\\{}'.format(out_netk_layer, stream_layer_name)
with arcpy.da.SearchCursor(feature_class_path, ["SHAPE@"]) as cursor:
for row in cursor:
shape = row[0]
if shape.isSelected:
total_length += shape.length
arcpy.AddMessage("Total length : {} meters".format(total_length))
else:
arcpy.AddWarning("no trace result")
arcgisscripting.ExecuteError: Execution failed. The parameters are not valid.
ERROR 000732: Input Entities: Dataset out_net_lay/stream does not exist or is not supported
Where can I find a code example? What anomaly do you see here? Thanks for everything