Ich habe etwas Code von meinem Lehrer, aber wenn ich es als ein Skript in Modeler ausführen, erzeugt es einen Fehler. Hier ist ein Teil des Codes, der Rest wiederholt sich aber mit anderen Werten für das DIST-Feld. Dieser Code soll das "DIST" -Feld zu einer Feature-Class hinzufügen und basierend auf den Bedingungen im UpdateCursor ausfüllen.Cursor update in mit arcpy, um Werte zu füllen
#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)
Bitte folgen Sie der Formatierung [Richtlinien] (https://Stackoverflow.com/help/mcve), um eine Frage zu stellen. – user3382203
Worin besteht der Fehler? Verwenden Sie Arc 10.1 oder höher? – Erica
ist es ein Syntaxfehler. Version 10.3 glaube ich – deakin1416