Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am going through thousands and thousands of road lines and giving them a value based on QC with imagery. So for instance for the add_data field I give it one of these four numbers 0 = not examined 1 = include 2 = consider excluding 3 = exclude 4 = DC But for each of these I also need to fill out comments and type of road data. So I was wondering if there is a way to calculate the comment and other fields based on the add_value field? So maybe it might look like this for the add data:

"1" = "include" comment = looks good RD_Typ = Major Road.
"2" = "include" comment = looks good RD_Typ = Dirt Road.
"3" = "include" comment = Joined data to other data RD_Typ = Major Road.
"4" = "include" comment = Joined data to other data = Dirt Road.

..... and so on you get the point. So the question is can I calculate the other fields based on the number I calculate in the add data field. I know I could do this with a join and then calc field but that just does not seem to be as much fun.

Thanks for your help.

share|improve this question

1 Answer 1

You should have no problem calculating a field based on another. One way to accomplish this is through the field calculator directly. You can also easily incorporate calculations such as this using stand-alone Python scripting. I've attached a screenshot from ESRI's Calculate Field examples that will hopefully get you started. Keep in mind you will have to add to the pre-logic script code slightly by adding elif statements to account for all of your variables.

enter image description here

Another example in python from the same source:


Expression Type:

Code Block:
def Reclass(WellYield):
  if (WellYield >= 0 and WellYield <= 10):
    return 1
  elif (WellYield > 10 and WellYield <= 20):
    return 2
  elif (WellYield > 20 and WellYield <= 30):
    return 3
  elif (WellYield > 30):
    return 4
share|improve this answer
Thanks so much for your help. After I wrote this up i was thinking is this possible by adding the script to a "Button" and as the line is selected you out calc the field buy clicking one for the many buttons, as well needs to work for all lines selected not just one at a time. Just jumping into the scripting fun and just trying to think of different ways to get this done as quick as possible. Thanks for your help! –  user12577 Nov 7 '12 at 18:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.