# Import arcpy module import arcpy # Parameters input = "C:\\some feature class" #input feature class near = "C:\\some other feature class" #near feature class nearcount = "3" #number of nearest features output = "C:\\output table" #output table # Fun stuff # Process: Generate Near Table arcpy.GenerateNearTable_analysis(input, near, output, "", "NO_LOCATION", "NO_ANGLE", "ALL", nearcount) # Process: Add Field arcpy.AddField_management(output, "rank", "SHORT", "", "", "", "", "NON_NULLABLE", "NON_REQUIRED", "") rows = arcpy.UpdateCursor(output,"","","","IN_FID A; NEAR_DIST A") count = 0 for row in rows: if count == 0: curID = row.IN_FID count = count + 1 if row.IN_FID != curID: curID = row.IN_FID count = 1 row.RANK = count rows.updateRow(row) del row del rows
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.