linqy的个人博客分享 http://blog.sciencenet.cn/u/linqy

博文

arcpy 获取 gdb 下的所有的数据集以及所有的图层

已有 8435 次阅读 2019-5-24 16:31 |系统分类:科研笔记

利用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




https://wap.sciencenet.cn/blog-3134052-1180958.html

上一篇:python 读取Excel
下一篇:python 编码过程中的一些小知识
收藏 IP: 112.53.64.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-17 11:43

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部