AnsweredAssumed Answered

Exclude end points in polygon geometrie?

Question asked by JB1234510 on Oct 31, 2019
Latest reply on Nov 5, 2019 by JB1234510

Hello,

 

I try to find excactly identical points in a polygon feature class with the 10.4. basic license to search for polygon errors with python 2.7. The following script can't find end points in the row[1].lastPoint in line 18? I need to exclude start and end points. What's wrong or any ideas how to do better?

 

import arcpy

infc = r"R:\XXX\LSG_Fehler.shp"
outfc = r"C:\temp2\GleicheKoord.shp"
CoordList = list()

arcpy.env.overwriteOutput = True

# Enter for loop for each feature
#
for row in arcpy.da.SearchCursor(infc, ["OID@", "SHAPE@"]):
    # Print the current multipoint's ID
    #
    print("Feature {}:".format(row[0]))
    partnum = 0

   
    if row[1] == row[1].lastPoint:

        print row[1].lastPoint
        break

    # Step through each part of the feature
   
    else:
        for part in row[1]:
            # Print the part number
            #
            print("Part {}:".format(partnum))

            # Step through each vertex in the feature
           
               
            for pnt in part:

                if pnt:
                                  
                    # print("{}, {}".format(pnt.X, pnt.Y))
                    CoordList.append("{};{}".format(pnt.X, pnt.Y))
                else:
                    # If pnt is None, this represents an interior ring
                    #
                    print("Interior Ring:")
                   
            partnum += 1

# Find identical coordinates
output = set([x for x in CoordList if CoordList.count(x) > 1])
print(output)

spatial_reference = arcpy.SpatialReference(25832)

pt = arcpy.Point()
ptGeoms = []
for p in output:

    coord = p.split(";")
   
    pt.X = coord[0]
    print(coord[0])
    pt.Y = coord[1]
    print(coord[1])
    ptGeoms.append(arcpy.PointGeometry(pt, spatial_reference))

arcpy.CopyFeatures_management(ptGeoms, outfc)
arcpy.AddXY_management(outfc)

Attachments

Outcomes