您的位置:首页 > 其它

ArcPy列举字段

2017-01-11 15:56 232 查看
#列举字段

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:

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

...     sde_ds_user = sde_ds_names[0]

...     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 and sde_fc_name[0:10]=='DLG_K_C80_':

...                 sde_fc_fields = arcpy.ListFields(sde_fc)

...                 for sde_fc_field in sde_fc_fields:

...                     print ('field name {0} with type {1} and length {2}'.format(sde_fc_field.name,sde_fc_field.type,sde_fc_field.length))
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ArcGIS ArcPy Pyghon