ArcPy列举字段

#列举字段
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))

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

You may also like...