|
利用arcpy获取gdb下面的所有的数据集dataset以及所有的featureclass
# coding:utf-8 import arcpy import os gdbPath = r"C:\Users\Administrator\Desktop\JC1802.gdb" arcpy.env.workspace = gdbPath fcs = [] dscount = 0 fscount = 0 lstFC = arcpy.ListFeatureClasses() for fds in arcpy.ListDatasets('','') + ['']: if not fds == '': dscount = dscount + 1 for fc in arcpy.ListFeatureClasses('', '', fds): # 拼接图层路径 # fcs.append(os.path.join(str(gdbPath), str(fds), str(fc))) fcs.append(os.path.join(fds, fc)) for fcp in fcs: # 拼接并打印出来所有图层的路径 strPath = str(gdbPath)+"\\"+str(fcp) print strPath fscount = fscount+1 print '矢量数据集:'+str(dscount)+'个' print '矢量要素类:'+str(fscount)+'个'
参考:https://blog.csdn.net/esrichinacd/article/details/8593385
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-9-24 20:05
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社