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

#取得指定用户名下的所有数据集,并取得指定名称的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

转载自:https://blog.csdn.net/a_dev/article/details/54344307

You may also like...

退出移动版