def ExtremePoints (inFC): ScratchW = SWPN.ScratchWPathName () Exp.Export(inFC, ScratchW, "ExportTable") fichier = open(ScratchW + "\\ExportTable.txt", 'r') X = [] Y = [] XY = [] head = fichier.readline().split('\n')[0].split(';') iX = head.index("POINT_X") iY = head.index("POINT_Y") for l in fichier: X.append(float(l.split('\n')[0].split(';')[iX])) Y.append(float(l.split('\n')[0].split(';')[iY])) for i in range (0, len(X)) : XY.append((X[i],Y[i])) x = list(collections.Counter(XY).most_common()) n = 0 for i in range(0, len(x)) : if x[i][1] > 1 : n+=1 rows = arcpy.UpdateCursor(inFC) for line in rows : for cple in x[0:n] : if (round(line.POINT_X,1), round(line.POINT_Y,1)) == (round(cple[0][0],1), round(cple[0][1],1)) : line.Del = 1 rows.updateRow(line)
import def__ScratchWPathName as SWPN import def__SLEM as dS # Allow the temporary outputs overwrite arcpy.env.overwriteOutput = True # Inputs inFCtype = arcpy.GetParameterAsText(0) inFC = arcpy.GetParameterAsText(1) Centerline = arcpy.GetParameterAsText(2) SegmentationStep = arcpy.GetParameterAsText(3) OutputSeg = arcpy.GetParameterAsText(4) DeleteTF = arcpy.GetParameterAsText(5) # Dervied variable from inputs ScratchW = SWPN.ScratchWPathName() #=============================================================================== # CODING #=============================================================================== ############ ### Line ### ############ if str(inFCtype) == "Line": # Number of steps nstep = 2 if str(DeleteTF) == "true": nstep += 1 ncurrentstep = 1 #/segmentation of the polyline