with arcpy.da.SearchCursor(mPipes,["OID@","SHAPE@","SHAPE@JSON"]) as scursor: for row in scursor: print row[0] expression = '"OBJECTID" = {0}'.format(row[0]) ogeom = None for part in row[1]: #row 1 for geometry object, row[2] for json mgeom = row[2] with arcpy.da.SearchCursor(oPipes,["OID@","SHAPE@","SHAPE@JSON"],where_clause=expression) as check: for i in check: for p in i[1]: #i[1] for geometry object, i[2] for json ogeom = i[2] if ogeom == mgeom: print "Equals!" else: print "Not Equals!" print ogeom print mgeom print ''
Solved! Go to Solution.
Hi Cody,
When I export a single feature twice (to different feature classes) and compare both feature geometries, it results in:
shp1 != shp2
shp1.WKT == shp2.WKT
shp1.JSON == shp2.JSON
shp1.__dict__ != shp2.__dict__
not shp1 is shp2
Even if I read the same feature from the same feature class twice, they will not be the same.
Although one may assume that the geometry is the same, since we are comparing objects, these objects are consuming different parts in memory and for that are considered different. Only if it's the same instance of an object it will test equal.
Kind regards,
Xander
if ogeom.equals(mgeom): # do something....