<< Click to Display Table of Contents >>
ListFields
用於列出Feature class 中所有Fields 物件(屬性欄位物件)
語法:
ListFields (dataset, wild_card)
參數 |
說明 |
參數類型 |
dataset |
Feature class資料集,可以是feature layer 或是Feature class檔案 (.geo或是.shp) |
字串 |
wild_card |
限制回傳结果的條件,若不指定,則回傳所有Fields 物件 |
字串 |
回傳值
類型 |
說明 |
Fields |
Feature class 中所有Field物件的集合 |
範例:
import sgpy # 從目前圖層集中取得feature layer (feature class) sgd = sgpy.mapping.MapDocument("current") df = sgd.activeDataFrame layerlist = sgpy.mapping.ListLayers(df)
layer=layerlist[0]
# 取得feature class中所有field的集合
fields = sgpy.ListFields(layer) # 透過迴圈,逐一取得單一field,列印出名稱 for field in fields: print field.name del field del fields |
©2015 Supergeo Technologies Inc. All rights reserved.