1. 程式人生 > >arcgis python獲得字段唯一值

arcgis python獲得字段唯一值

search tin geo inf pri input nat num www.

arcgis python獲得字段唯一值

# Import native arcgisscripting module
import arcgisscripting, sys
# Create the geoprocessor object
gp = arcgisscripting.create(9.3)

# Table and field name inputs
inTable = sys.argv[1]
inField = sys.argv[2]

rows = gp.SearchCursor(inTable)
row = rows.Next()
# Create an empty list
uniqueList = []

while row:
# If the value is not already in the list, append it
if row.GetValue(inField) not in uniqueList:
uniqueList.append(row.GetValue(inField))
row = rows.Next()
# Sort the list alphanumerically
uniqueList.sort()
print uniqueList

分類: Python

arcgis python獲得字段唯一值