空间连接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