I have created a new raster from two raster datasets using combine operation in ArcGIS. The new attribute table has two fields from the input rasters. What I need is, to compare these two fields and assign meaningful values to a new field.

For example:

see the attached image (I don't know how to past a table in here) enter image description here

... this list goes to few hundred.

“New Class” is the field that I need to assign the new values.

I have been using “code block” in field calculator using python. But it is too long that I have to write individual statements for each unique combination. I am looking for an efficient way other than my method.

Something like reading from a reclassification table?

  • Can you provide a sample of the code block?
    – ccn
    Feb 28, 2013 at 3:38
  • here is a section of the code block. expression = "lc_change(!Raster1!, !Raster2!)" codeblock = """def lc_change(Raster1, Raster2): if Raster1 == 42 and Raster2 == 42: return 0 if Raster1 == 42 and Raster2 == 41: return 113 if Raster1 == 52 and Raster2 == 41: return 115 if Raster1 == 52 and Raster2 == 43: return 145
    – tdr
    Feb 28, 2013 at 16:20
  • The [Value] and [Newvalue] columns (illustrated) provide all the information needed to reclassify this raster.
    – whuber
    Feb 28, 2013 at 17:23
  • I suspected your code block was something like that and it always seems easier to go back to the familiarity of Excel and use the formulae/functions as suggested in your graphic. The only improvements I could recommend is: using one if statement to catch all if Raster1 == Raster2: return 0; and then use some nested/looped if/elif statements with iterating variables (if the NewValue values are iterable). By the time you figure all that out the table join in my answer post will hopefully have worked out for you.
    – ccn
    Feb 28, 2013 at 18:23

1 Answer 1


It appears from your graphic that you have this calculated in Excel, so you can import as a standalone table in to ArcMap (gdb or dbf) with the unique combination of calculated values. Then use the Join Field tool to copy over those 'NewValue' values to the raster table (If you don't have an ArcInfo license you will have to use the Add Join tool followed by Calculate Field). I typically concatenate fields to help with multi-field joining; therefore !Raster1! + "_" + !Raster2! (Python parser) has its values copied to a new field named JoinField, and this same field is used in the 'reclassification' table to identify the unique combination of calculated values.

  • I'm working on your suggestion. I will post what is the result in here. Thanks for your support. Please post if a new idea comes to your mind.
    – tdr
    Feb 28, 2013 at 16:26
  • Hi, It didnt work out for my purpose, b'se there are values that I need to assign logically. However, I was wondering if there is a way to read two columns (Raster1 and Raster2) at once and assign according to 3rd column (NewValue). Looking for something like this: If "From Field" == Raster1 AND "To Field" == Raster2 return "NewValue" May be sound stupid.. :) but, looking for something like that.. thanks
    – tdr
    Mar 1, 2013 at 0:34
  • If you have this logic already calculated in Excel then the above will work. Otherwise, you'll have to complete the really long code block you started for the field calculator, or perhaps move to a Python script to help set this up, depending on the logic. Sorry I don't understand what your logic is so I am at a loss as to how you can make it more efficient.
    – ccn
    Mar 1, 2013 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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