>>> arcpy.env.overwriteOutput = True >>> rows = arcpy.SearchCursor(fc) >>> for row in rows: feat = row.shape result1 = arcpy.MakeFeatureLayer_management(fc, 'testlyr') result2 = arcpy.SelectLayerByLocation_management('testlyr', 'SHARE_A_LINE_SEGMENT_WITH', feat) count = int(arcpy.GetCount_management('testlyr').getOutput(0)) rowsL = arcpy.SearchCursor('testlyr') print 'The test subject OBJECTID: ' + str(row.OBJECTID) print '...the selection count (not including self): ' + str(count - 1) for rowL in rowsL: if rowL.OBJECTID != row.OBJECTID: print '...overlapping segment OBJECTID: ' + str(rowL.OBJECTID) print '\n'
Topology tools are what I use for this type of thing. For this, the data needs to be in a geodatabase. Then you create the topology in that geodatabase and then create rules like "must not overlap" and "must not have gaps". Then there is a topology tool bar that makes these fixes easier.There is another process that may do what you want. I've heard of it only recently, but have not had to use it.
Do I need to make a copy of the feature class before doing this? Is there a chance I will mess the file up and can't go back? Thanks for the help.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.