I'm trying to dissolve polygons using polygon neighbors in arcgis 10.1, but don't want to use duplicate rows. However, the field values will switch when they're duplicated.
If I run this:
arcpy.env.workspace = "C:\Users\Ant\Documents\ArcGIS\ITN.gdb"
fc = r"BLPUs_PolygonNeighbors"
fields = ["src_OBJECTID","nbr_OBJECTID"]
with arcpy.da.SearchCursor(fc,fields) as cursor:
for row in cursor:
print "{0}, {1}".format(row[0],row[1])
I get:
1, 2
1, 4
2, 1
2, 3
2, 4
3, 2
3, 4
4, 1
4, 2
4, 3
Then when I run my script to dissolve based on these values, I will end up with duplicate polygons such as 1 & 2 as well as 2 & 1. Can someone please help me with writing the UpdateCursor to go through and delete these duplicates? I don't know how to look through when the fields have then switched.
Also, what if I then have three polygons to merge? If I had three columns such as OID1, OID2 and OID3, is there an SQL expression to capture whether the three values in these have been repeated in a different order but in the same row previously? Thanks