<< Click to Display Table of Contents >>

 

ListFeatureClasses

 

 

用於將圖層集中feature class檔案所在的路徑列印出來

語法:

ListFeatureClasses(wild_card, feature_type)

參數

說明

參數類型

wild_card

限制回傳结果的條件,若不指定,則回傳所有feature class檔案所在路徑

字串

feature_type

限制只回傳符合指定幾何類型的feature class, feature_type 可以為下列任一種:

1. point

2. line

3. polygon

字串

回傳值

類型

說明

字串

feature class檔案所在的路徑所組成的字串

範例:

import sgpy

# 設定工作目錄

sgpy.env.workspace = "D:/temp"

# 列印feature class名稱

results = sgpy.ListFeatureClasses()

for fc in results:

   print("File: {0}".format(fc))

   print("Fields:")

#列印feature class所有欄位名稱

   flds = sgpy.ListFields(fc)

   for fld in flds:

       print(fld.name)

 


©2015 Supergeo Technologies Inc. All rights reserved.