Arcpy查找指定用户的所有要素类并列举其属性信息
代码:
#-*-coding:gbk-*-
import os
import arcpy
from arcpy import env
if __name__=='__main__':
env.workspace = r'C:\Users\lenovo\AppData\Roaming\Esri\Desktop10.2\ArcCatalog\Connection to orcl.sde'
ws = env.workspace
fcs = arcpy.ListFeatureClasses()
id=0
for fc in fcs:
fcn= fc.split('.')
if fcn[0].upper()=='SZTEST':
fcf=os.path.join(ws,fc)
des = arcpy.Describe(fcf)
st=des.shapeType
ty='1'
if st.upper()=='POLYLINE':
ty='2'
else:
if st.upper()=='POLYGON':
ty='3'
ext='-1,1,-1,1,,0,0'
id+=1
print ('{0},-1,{1},{2},{3},{4}'.format(id,fcn[1],fcn[1],ty,ext))
结果:
Connected to pydev debugger (build 172.3968.37)
1,-1,VEGP_J,VEGP_J,1,-1,1,-1,1,,0,0
2,-1,VEGL_J,VEGL_J,2,-1,1,-1,1,,0,0
3,-1,VEGA_J,VEGA_J,3,-1,1,-1,1,,0,0
4,-1,TERP_J,TERP_J,1,-1,1,-1,1,,0,0
5,-1,TERL_J,TERL_J,2,-1,1,-1,1,,0,0
6,-1,TERA_J,TERA_J,3,-1,1,-1,1,,0,0
7,-1,RFCP_J,RFCP_J,1,-1,1,-1,1,,0,0
8,-1,RFCL_J,RFCL_J,2,-1,1,-1,1,,0,0
9,-1,RFCA_J,RFCA_J,3,-1,1,-1,1,,0,0
10,-1,RESP_J,RESP_J,1,-1,1,-1,1,,0,0
11,-1,RESL_J,RESL_J,2,-1,1,-1,1,,0,0
12,-1,RESA_J,RESA_J,3,-1,1,-1,1,,0,0
13,-1,PIPP_J,PIPP_J,1,-1,1,-1,1,,0,0
14,-1,PIPL_J,PIPL_J,2,-1,1,-1,1,,0,0
15,-1,PIPA_J,PIPA_J,3,-1,1,-1,1,,0,0
16,-1,LRRP_J,LRRP_J,1,-1,1,-1,1,,0,0
17,-1,LRRL_J,LRRL_J,2,-1,1,-1,1,,0,0
18,-1,LRRA_J,LRRA_J,3,-1,1,-1,1,,0,0
19,-1,LRDP_J,LRDP_J,1,-1,1,-1,1,,0,0
20,-1,LRDL_J,LRDL_J,2,-1,1,-1,1,,0,0
21,-1,LRDA_J,LRDA_J,3,-1,1,-1,1,,0,0
22,-1,LFCP_J,LFCP_J,1,-1,1,-1,1,,0,0
23,-1,LFCL_J,LFCL_J,2,-1,1,-1,1,,0,0
24,-1,LFCA_J,LFCA_J,3,-1,1,-1,1,,0,0
25,-1,HYDP_J,HYDP_J,1,-1,1,-1,1,,0,0
26,-1,HYDL_J,HYDL_J,2,-1,1,-1,1,,0,0
27,-1,HYDA_J,HYDA_J,3,-1,1,-1,1,,0,0
28,-1,HFCP_J,HFCP_J,1,-1,1,-1,1,,0,0
29,-1,HFCL_J,HFCL_J,2,-1,1,-1,1,,0,0
30,-1,HFCA_J,HFCA_J,3,-1,1,-1,1,,0,0
31,-1,CPTP_J,CPTP_J,1,-1,1,-1,1,,0,0
32,-1,CPTL_J,CPTL_J,2,-1,1,-1,1,,0,0
33,-1,BRGP_J,BRGP_J,1,-1,1,-1,1,,0,0
34,-1,BRGL_J,BRGL_J,2,-1,1,-1,1,,0,0
35,-1,BRGA_J,BRGA_J,3,-1,1,-1,1,,0,0
36,-1,SOUTH_GYJCCH_USERZONE,SOUTH_GYJCCH_USERZONE,3,-1,1,-1,1,,0,0
37,-1,BOUP_J,BOUP_J,1,-1,1,-1,1,,0,0
38,-1,BOUL_J,BOUL_J,2,-1,1,-1,1,,0,0
39,-1,BOUA_J,BOUA_J,3,-1,1,-1,1,,0,0
40,-1,ANNO_J,ANNO_J,3,-1,1,-1,1,,0,0
Process finished with exit code 0
SDE空间数据如下图:
转载自:https://blog.csdn.net/a_dev/article/details/78307172