Reclassify in ModelBuilder

3649
3
Jump to solution
04-24-2013 12:46 PM
melaniewilliams
New Contributor II
As part of a much larger model, I am trying to use the Reclassify tool on a raster file. The raster file was made at the 30 cell size with only three rows.  I'm reclassifying the original raster file three times to produce three different new raster files. 

Original raster attribute table:
Rowid;   Value; Count
0;   1;         609624542
1;   2;         854540105
2;   3;         167276779

I used the Value field to reclass it once to 1, 0, 0, and NoData to 0.  Did a second reclass to 0, 1, 0, and NoData to 0 and then a third reclass to 0, 0, 1, and NoData to 0.  This works great for the second reclass in term of it producing a raster file that only has a 1 and 0 Value and is shown by "Unique Value".  The other two files are shown in "Stretched" and don't have an attribute table attached. 

I have search all over the ArcGIS Desktop Help site and the forums and haven't seen anything that really applies to this type of situation.  However I may not be asking or searching the right thing. 

Any help would be greatly appreciated!
Thanks,
Mel
0 Kudos
1 Solution

Accepted Solutions
curtvprice
MVP Esteemed Contributor
I'm reclassifying the original raster file three times to produce three different new raster files. 

Original raster attribute table:
Rowid;   Value; Count
0;   1;         609624542
1;   2;         854540105
2;   3;         167276779

I used the Value field to reclass it once to 1, 0, 0, and NoData to 0.  Did a second reclass to 0, 1, 0, and NoData to 0 and then a third reclass to 0, 0, 1, and NoData to 0.


Mel,

I think the Raster Calculator tool would be a more straight-forward approach as you can use the IsNull and Con tools together like this:


  1. Con(IsNull("inraster"), 0, Con("inraster" == 1, 1, 0))

  2. Con(IsNull("inraster"), 0, Con("inraster" == 2, 1, 0))

  3. Con(IsNull("inraster"), 0, Con("inraster" == 3, 1, 0))

View solution in original post

0 Kudos
3 Replies
curtvprice
MVP Esteemed Contributor
I'm reclassifying the original raster file three times to produce three different new raster files. 

Original raster attribute table:
Rowid;   Value; Count
0;   1;         609624542
1;   2;         854540105
2;   3;         167276779

I used the Value field to reclass it once to 1, 0, 0, and NoData to 0.  Did a second reclass to 0, 1, 0, and NoData to 0 and then a third reclass to 0, 0, 1, and NoData to 0.


Mel,

I think the Raster Calculator tool would be a more straight-forward approach as you can use the IsNull and Con tools together like this:


  1. Con(IsNull("inraster"), 0, Con("inraster" == 1, 1, 0))

  2. Con(IsNull("inraster"), 0, Con("inraster" == 2, 1, 0))

  3. Con(IsNull("inraster"), 0, Con("inraster" == 3, 1, 0))

0 Kudos
melaniewilliams
New Contributor II
Mel,

I think the Raster Calculator tool would be a more straight-forward approach as you can use the IsNull and Con tools together like this:


  1. Con(IsNull("inraster"), 0, Con("inraster" == 1, 1, 0))

  2. Con(IsNull("inraster"), 0, Con("inraster" == 2, 1, 0))

  3. Con(IsNull("inraster"), 0, Con("inraster" == 3, 1, 0))



Curtis,
This worked beautifully!  I have been looking for a simplistic way to use if/else statements.  As an on-the-job-learner, I was not aware of the Raster Calculator.  And it looks like I can use the 'Single Output Map Algebra' tool to place this in ModelBuilder. 

Thanks so much! You just opened up a pretty large door for me!
0 Kudos
curtvprice
MVP Esteemed Contributor
And it looks like I can use the 'Single Output Map Algebra' tool to place this in ModelBuilder.


Yes, indeed. Map Algebra is quite useful!

For the thread I should add that when you move up to 10.x SOMA and Raster Calculator (from the menu) are no longer available. Your 9.x model that uses SOMA will still run, you just will have to do it differently in new models.

What's new in ArcGIS Spatial Analyst 10
0 Kudos