遍历ArcMap已加载数据的属性

import arcpy
f = open("D:\workspace\coords.txt","w")
with arcpy.da.SearchCursor("DLTB",("TBBH","IMAGEINFO")) as cursor:
    for row in cursor:
        if(row[1]==""):
            continue
        pics = row[1][:-1].split(";")
        for pic in pics:
            print(row[0],vals)
            vals = pic.split(",")
            str = row[0]
            for val in vals:
                str+=","+val
            str+="\n"
            f.write(str)
f.close()

1、打开arcmap
2、加载DLTB要素
3、打开Python窗口
4、加载Python代码,在Python代码窗口右键,选择Load,选择Python代码文件
5、修改python代码中文本文件的路径,修改数据名称,字段名称
6、选中python代码最后一行,回车几次即可

posted on 2019-04-15 16:57  Lzhm216  阅读(411)  评论(0编辑  收藏  举报

导航