借助PyCharm环境,在不打开ArcGIS的情况下,编写Python代码,获取矢量数据的所有字段。
import arcpyshp = 'C:\data\out\Export_Output.shp'fields = arcpy.ListFields(shp)for f in fields:print f.name+‘,’+f.type
运行结果:
C:\Python27\ArcGIS10.8\python.exe C:/Users/Administrator/PycharmProjects/untitled/11.pyFID,OIDShape,GeometryZ______ID,DoubleID,DoubleOTYPE,DoubleSTYPE,DoubleCLASS,DoubleNAME,StringCITY,StringDISTRICT,StringPROVINCE,StringTEL,StringADDRESS,StringDOOR,StringPOSTAL,StringCONTAIN,DoubleCOMMENT,StringUPDATED,StringProcess finished with exit code 0