I'm working on a little arcpy script to compare the geometry of features (linked by a matching ID field
I've got a couple of search cursors populating dictionaries for the two feature classes which I then am trying to compare to find where features (that should be identical shapes) don't match.
I have run into a snag in my concept though in that the output from
SHAPE@ is returning
False when I compare the features I know are identical (should return
import arcpy fields = ['LineID', 'SHAPE@'] x = 'Line1' # Feature Class #1 y = 'Line2' # Feature Class #2 xDict = dict() yDict = dict() with arcpy.da.SearchCursor(x, fields) as cursor: for row in cursor: xDict[row] = row with arcpy.da.SearchCursor(y, fields) as cursor: for row in cursor: yDict[row] = row
When I test I get
xDict == yDict > False
False even though I know that record #1 is identical in both feature classes.
Is there another way I can use my search cursors to compare the shape of the two features? I know there are
.JSON options for Shape - are these valid options for a comparison? My brief testing suggests they are, but I'm unsure whether there are occasions where they would also return
xDict.WKB == yDict.WKB > True
xDict.equals(yDict) # Should be True > True xDict.equals(yDict) # Should be False > True xDict.equals(yDict) # Should be False > False