I want to replace the Digital number (DN) values in a raster file with some other values which are present in a text file;in the text file, I have a table which it's first column are all possible DN and on the next column I have corresponding values to be replaced.

First of all, I want to know which ways make it possible to use this table to replace DN values with Python specially arcpy?

I want to use Lookup(inRaster, lookupField) in ArcMap but I do not know how can I introduce my separate text file to this statement as a lookup table?


If you look at the Lookup tool help page, the look up table should be derived from the raster attribute table.

Raster datasets that contain attribute tables typically have cell values that represent or define a class, group, category, or membership. For example, a satellite image may have undergone a classification analysis to create a raster dataset that defines land uses.

To build a raster table use "Build Raster Attribute Table" tool. (Note that your raster should be single band!)

Then add your csv table to the map and do a join to append the attributes of your lookup table to the raster.

Finally use Lookup tool to change and update the DN values.

  • Happy to hear that. If this is your answer, consider marking it as answer. – Farid Cheraghi Nov 8 '15 at 17:46

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.