3

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 five 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.

1 Answer 1

6

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:
Reclass(!WELL_YIELD!)

Expression Type:
PYTHON_9.3

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
0

Your Answer

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

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