以下是我的python脚本的一部分:
gp.CalculateField_management("parcs", "Apn", "[oldApnfield]")
问题是,我从中计算的字段在每个shapefile中将被命名为不同的名称,因此我不能在计算中使用字段名。是否有python用来标识字段的内部ID?用什么python语言来表示“数据库中的第一个字段”而不是使用字段名?你知道吗
谢谢你的帮助。我非常接近,但是现在新字段中的每一行的计算结果都是PIDNUM而不是PIDNUM的值。。。。。你知道吗
import arcgisscripting
# Create the geoprocessor object
gp = arcgisscripting.create(9.3)
gp.OverWriteOutput = True
# Set the workspace. List all of the folders within
gp.Workspace = "C:\ZP44"
fcs = gp.ListWorkspaces("*","Folder")
#
for fc in fcs:
print fc
gp.MakeFeatureLayer(fc + "\\Parcels.shp", "parcs")
fieldList = gp.ListFields("parcs")
print fieldList[2].Name
field1 = fieldList[2].Name
print field1
gp.CalculateField_management("parcs", "Apn", "[field1]")
每次都可以使用^{} 获取字段的名称。你知道吗
相关问题 更多 >
编程相关推荐