I've been unable to get a simple block of code and am hoping someone can spot what is wrong. I feel like I'm blind.
1) I create a new short integer field called "SpeedLimit" in my ArcGIS attribute table that signifies the speed limit for a road type.
2) The road type is a string found in the field "fclass" in the same table.
I open the field calculator for the SpeedLimit field and fill the following:
Pre-Logic Script Code:
def Speed(class):
if (class == ‘secondary’ or class == ‘tertiary’ or class == ‘trunk’ or class == ‘motorway’ or class == ‘primary’):
return 70
elif (class == ‘secondary_link’ or class == ‘tertiary_link’ or class == ‘trunk_link’ or class == ‘motorway_link’ or class == ‘primary_link’):
return 45
elif (class == ‘service’ or class == ‘track_grade1’ or class == ‘track_grade2’ or class == ‘track_grade3’ or class == ‘track_grade4’ or class == ‘track_grade5’):
return 15
else:
return 30
SpeedLimit =
Speed(!fclass!)
Can anyone spot what I'm doing wrong to receive a syntax error?
Aucun commentaire:
Enregistrer un commentaire