您的位置:首页 > Web前端

ArcPy取得指定所有数据集中的FeatureClass

2017-01-11 15:51 211 查看
#取得指定用户名下的所有数据集,并取得指定名称的FeatureClass

>>> file_names=('BOUAN','BOULK','BOUNT','BOUPT','CTRLK','CTRPT','HYDAN','HYDLK','HYDNT','HYDPT','PIPAN','PIPLK','PIPNT','PIPPT','RESAN','RESLK','RESNT','RESPT','ROAAN','ROALK','ROANT','ROAPT','TERAN','TERLK','TERNT','TERPT','VEGAN','VEGLK','VEGNT','VEGPT')

... arcpy.env.workspace=r'Database Connections/Connection to Orcl.sde'

... workspace = arcpy.env.workspace

... sde_datasets = arcpy.ListDatasets()

... for sde_dataset in sde_datasets:

...     print sde_dataset

...     sde_ds_names = sde_dataset.split('.')

...     sde_ds_user = sde_ds_names[0]

...     print sde_ds_user

...     if sde_ds_user=='GYJCCH':

...         for sde_fc in arcpy.ListFeatureClasses(feature_dataset=sde_dataset):

...             sde_fc_names = os.path.split(sde_fc)

...             sde_fc_fullnames = sde_fc_names[1].split('.')

...             sde_fc_name = sde_fc_fullnames[1]

...             sde_fc_shortname = sde_fc_name[-5:]

...             if sde_fc_shortname in file_names:

...                 print sde_fc
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息