Select to view content in your preferred language

Create a new Raster, determining new cell values based on list

2366
2
Jump to solution
01-12-2016 12:19 PM
PeterWilson
Frequent Contributor

I'm currently using ArcGIS 10.2.2 (Advanced).

I need to generate a new raster from an existing raster by comparing the cell values to a list where an new cell value will be listed against the old value.

The existing unique list of values:

  

  • 1
  • 8
  • 7
  • 6
  • 5
  • 4
  • 3
  • 2

The new cell values are:

  • 1        -      1
  • 2        -      8
  • 4        -      7
  • 8        -      6
  • 16      -      5
  • 32      -      4
  • 64      -      3
  • 128    -      2

I'm looking for advice in how I can achieve creating a new raster based on comparing the existing cell values and replacing them with the new cell values using python. I could create a map algebra function to achieve the following using if statements, but feel that there should be a better method using Python. I was wondering if numpy arrays to achieve the following is suitable, but I have used them before so any help in getting started will be appreciated. Any other methods using python are also welcome.

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

these come to mind

Reclass by Table—Help | ArcGIS for Desktop

Reclass by ASCII File—Help | ArcGIS for Desktop

An overview of the Raster Reclass tools—Help | ArcGIS for Desktop or just about any in here.  There is no need to use the raster calculator or if statements.  These functions can be done in numpy, but if you have the spatial analyst extension, you may as well use the existing tools

View solution in original post

2 Replies
DanPatterson_Retired
MVP Emeritus

these come to mind

Reclass by Table—Help | ArcGIS for Desktop

Reclass by ASCII File—Help | ArcGIS for Desktop

An overview of the Raster Reclass tools—Help | ArcGIS for Desktop or just about any in here.  There is no need to use the raster calculator or if statements.  These functions can be done in numpy, but if you have the spatial analyst extension, you may as well use the existing tools

PeterWilson
Frequent Contributor

Hi Dan

Thanks for reminding me about the reclass by table tool, clean forgot about it.

Regards, Peter Wilson