Create a flag feature class from different sources to trace network

101
0
11-30-2021 06:23 AM
David_RonaldSuárez_Urresti
New Contributor III

I have to trace downstream my geometric network, but I need to add some flags programatically from different feature class. I am trying something like:

arcpy.CreateFeatureclass_management('in_memory', 'inmemory_flag', "POINT", "", "DISABLED", "DISABLED", "projection", "", "0", "0", "0")
fc=r'in_memory\inmemory_flag'
cursor = arcpy.InsertCursor(fc)
 
then I interate my feature classes (1...n) and add the flags like:
for feature in featureClass1:
    row = cursor.newRow()
    row.setValue("SHAPE", feature.getValue("SHAPE"))
    cursor.insertRow(row)
 
Then when I run the trace like:
 
flFlag = "flFlag"
arcpy.MakeFeatureLayer_management(fc, flFlag , "", "", "")
arcpy.TraceGeometricNetwork_management(Red_electrica, traceResults, flFlag, "TRACE_DOWNSTREAM", barriers, "", "", "", "SIGELEC.TramoBajaTension;SIGELEC.Barra", "NO_TRACE_ENDS", "TRACE_INDETERMINATE_FLOW", "", "", "AS_IS", "", "", "", "AS_IS")
 
But I get the error:
ExecuteError: ERROR 001191: No flag found from the flag junction feature class.
 
Any idea how to create my flags from different feature classes?
0 Kudos
0 Replies