藉助PyCharm環境,在不打開ArcGIS的情況下,編寫Python代碼,獲取矢量數據的所有字段。
import arcpy
shp = '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.py
FID,OID
Shape,Geometry
Z______ID,Double
ID,Double
OTYPE,Double
STYPE,Double
CLASS,Double
NAME,String
CITY,String
DISTRICT,String
PROVINCE,String
TEL,String
ADDRESS,String
DOOR,String
POSTAL,String
CONTAIN,Double
COMMENT,String
UPDATED,String
Process finished with exit code 0