ArcGIS Python获得一个数据库所有要素类
import arcpy import os arcpy.env.workspace = "E:\\BaiduNetdiskDownload\\GeoScene Pro入门课程数据(1)\\data1-10\\data1-10\\第八章\\北京要素.gdb" datasets = arcpy.ListDatasets(feature_type='feature') datasets = [''] + datasets if datasets is not None else [] for ds in datasets: for fc in arcpy.ListFeatureClasses(feature_dataset=ds): path = os.path.join(arcpy.env.workspace, ds, fc) print(path)
修改
import arcpy import os arcpy.env.workspace = "E:\\BaiduNetdiskDownload\\GeoScene Pro入门课程数据(1)\\data1-10\\data1-10\\第八章\\北京要素.gdb" datasets = arcpy.ListDatasets(feature_type='feature') datasets = [''] + datasets #if datasets is not None else [] for ds in datasets: for fc in arcpy.ListFeatureClasses(feature_dataset=ds): path = os.path.join(arcpy.env.workspace, ds, fc) print(path)