I'm writing a script to find duplicate cables in a layer. I want to create a layer from the result to find the closest cables to those already cut with ArcPy but I can't find a way to do it.
The license I use is Standard so I don't have the FindIdentical_management function.
here is my code :
couche_cable = arcpy.MakeFeatureLayer_management(chem_caftth)
champ_a_verfier = ["REFERENCE", "OBJECTID", "CREATIONUSER", "LASTUSER", "USERREFERENCE", "SUBTYPEID", "SHAPE"]
values={}
values["Ref_Nulle"]=0
with arcpy.da.SearchCursor(couche_cable, champ_a_verfier) as rows:
for r in rows:
if r[0] in [None,""]:
values["Ref_Nulle"]+=1
else:
if r[0] not in values:
values[r[0]]=1
else:
values[r[0]]+=1
del rows
dictDoublons = {}
dictPasDoublons = {}
cable_cda = 'CDA'
count = 0
for item in values:
if values[item] > 1 and values[item] < 3:
if not item.startswith("CDA"):
dictDoublons[item] = 'Doublons'
count+=1
arcpy.AddWarning('Il y a {} cables en doublons a Verifier / Corriger.'.format(count))
else:
dictPasDoublons[item] = 'PasDoublons'
