with arcpy.da.SearchCursor(fc, ["LAT", "LON"]) as cursor:
for row in cursor:
print("Print rows: {} ".format(row)
xy_list = [(row[0],row[1]) for row in cursor]
print("Print list: {} ".format(xy_list))
输出:
Print rows: (44.8175669441669, -63.6431023726842)
Print list: [(44.8175486319183, -63.6432418986223), (44.8170733108224, -63.644658488894)]
我从 SearchCursor 中提取纬度和经度以添加到列表的要素类具有三个属性。我不明白为什么没有添加所有三个坐标。
注意:我打印的“打印行:(44.8175669441669,-63.6431023726842)”的坐标不在列表中。
您在 for 循环中使用“光标”可迭代一次,然后在 for 主体中使用列表理解再次使用(第二次和第三次)。
看来你最终想要的是xy_list=列表(光标)
没有?
我是一名优秀的程序员,十分优秀!