Trying to write a code where python checks for overlapping polygons within a file geodatabase in the current mxd and basically prints the feature class names overlapping. Here is what i have:
import osimport arcpyimport arcpy.mappingarcpy.env.workspace = "C:\Users\blah\Desktop\python work\Toolbar\Tools.gdb"mxd = arcpy.mapping.MapDocument("CURRENT") fcList = arcpy.ListFeatureClasses(mxd, "*")for fc in fcList: oid_field = arcpy.ListFields(fc, '*', 'OID')[0] for row in arcpy.SearchCursor(fc, '', '', 'Shape;{0}'.format(oid_field.name)): for row2 in arcpy.SearchCursor(fc, '', '', 'Shape;{0}'.format(oid_field.name)): if row2.Shape.overlaps(row.Shape): print '{0} overlaps {1}'.format(str(row2.getValue(oid_field.name)), str(row.getValue(oid_field.name))) else: print "no overlaps"When i run this script within the mxd it gives the message ": ERROR 999999: Error executing function.Feature type is invalid"
Any ideas why its not working? Also when i try to use the print command it doesnt print anything in the process window within arcmap.
أكثر...
import osimport arcpyimport arcpy.mappingarcpy.env.workspace = "C:\Users\blah\Desktop\python work\Toolbar\Tools.gdb"mxd = arcpy.mapping.MapDocument("CURRENT") fcList = arcpy.ListFeatureClasses(mxd, "*")for fc in fcList: oid_field = arcpy.ListFields(fc, '*', 'OID')[0] for row in arcpy.SearchCursor(fc, '', '', 'Shape;{0}'.format(oid_field.name)): for row2 in arcpy.SearchCursor(fc, '', '', 'Shape;{0}'.format(oid_field.name)): if row2.Shape.overlaps(row.Shape): print '{0} overlaps {1}'.format(str(row2.getValue(oid_field.name)), str(row.getValue(oid_field.name))) else: print "no overlaps"When i run this script within the mxd it gives the message ": ERROR 999999: Error executing function.Feature type is invalid"
Any ideas why its not working? Also when i try to use the print command it doesnt print anything in the process window within arcmap.
أكثر...