空間連接SpatialJoin的模式是JOIN-ONE-TO-MANY,空間連接后的屬性值分別存儲在多個重疊的多邊形中,需要將多個多邊形的屬性進行合並,不知道用什么工具或方法,就碼了幾行代碼,實現了需求。
for fc in fcs: if fc == "JMD_polygon_SpatialJoin1": fds = arcpy.ListFields(fc) with arcpy.da.SearchCursor(fc,"*") as cursor: i=1 for row in cursor: if row[2]==1 and row[6] in ["2","3","4","5","6","7","8"]: print ("{0}, {1}, {2}, {3}".format(i, row[0], row[2], row[6])) i += 1 print('"CX"={0} and "CY"={1}'.format(row[9],row[10])) with arcpy.da.UpdateCursor(fc,"*",'abs("CX"-{0})<0.0001'.format(row[9])) as cursor1: for row1 in cursor1: if row[0]!=row1[0]: print row1[0] row1[11]=row[11] cursor1.updateRow(row1) break