0

Using ArcGIS 10.2.2

In the picture below, I want to populate the Spd_Class field (short integer). The value of the Spd_Class attribute will be based on the TYPE field -

residential = 30 secondary = 35 primary = 50

is there a quick way to use the text field in TYPE to populate Spd_Class? I've been unable to think of a way to do this.

enter image description here

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Aug 11, 2015 at 15:36

1 Answer 1

5

In your Field Calculator, have the python parser enabled. You can do some neat things with the Field Calculator. I suggest checking out the Field Calculator Unleashed from ESRI for a bit of a code introduction to the Field Calculator. Then check out their documentation for more advanced ideas.

I am using lower() and strip() in case there are values that don't conform.

In the Pre-Logic part enter:

def myFunct(input):
 if input.lower().strip() == "residental":
 return 30
 elif input.lower().strip() == "secondary":
 return 35
 elif input.lower().strip() == "primary":
 return 50

In the bottom part, Spd_Class =

myFunct(!TYPE!)

answered Aug 11, 2015 at 15:41
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.