我有一些来自我的指导老师的代码,但当我在modeler中作为脚本运行时,它会产生一个错误。 下面是一段代码,其余部分重复,但DIST字段的值不同。 此代码旨在将“DIST”字段添加到要素类中,并根据UpdateCursor中的条件填充它。在
#Import arcpy and standard library modules
import arcpy, sys, os
# Get feature class from argument
zoneArcSelect = sys.argv[1]
# Add DIST field to input feature class
arcpy.AddField_management(zoneArcSelect, "DIST", "SHORT")
#get rows using update cursor and conflict selection
rows = arcpy.UpdateCursor(zoneArcSelect,"(LZONE = 'O-L' AND RZONE = 'M-1') OR (RZONE = 'O-L' AND LZONE = 'M-1')")
# calculate value for DIST and update row
for row in rows:
row.DIST = 100
rows.updateRow(row)
#get rows using update cursor and conflict selection
rows = arcpy.UpdateCursor(zoneArcSelect,"(LZONE = 'M-1' AND RZONE = 'RPC') OR (RZONE = 'M-1' AND LZONE = 'RPC')")
# calculate value for DIST and update row
for row in rows:
row.DIST = 200
rows.updateRow(row)
#get rows using update cursor and conflict selection
rows = arcpy.UpdateCursor(zoneArcSelect,"(LZONE = 'M-1' AND RZONE = 'RM-1') OR (RZONE = 'M-1' AND LZONE = 'RM-1')")
# calculate value for DIST and update row
for row in rows:
row.DIST = 200
rows.updateRow(row)
这是我自己的错,不是代码,当我在modeler中使用addField工具时,我没有称它们为LZONE和RZONE。所以这和导致问题的代码不匹配。在
相关问题 更多 >
编程相关推荐