[GIS] Merge rasters and retain value

arcgis-desktopraster-calculatorspatial-analyst

How do I merge multiple binary rasters that each have different values and still retain the values in the output file?

Background Information:

I am working on improving unsupervised classification by applying 4 slope classes to it for a grad school project.For example unsupervised classification clustered playa together, but there are some playa pixels on the top of 4,000 foot high mountains. By applying the slope classes to it using raster calculator, I can isolate those pixels and change them to the granitic mountain class.

EDIT: I did it like this:
("unsupervised"==3) & ("slope">=30) – this output would become mountains ("unupervised"==3) & ("slope"<30) & ("slope">=5) – this would become alluvial slope. There are 9 unsupervised classes and 4 slope classes. 9×4=36 outputs.

This process produced 36 rasters using raster calculator. These all have a value of 0 and 1. I tried all the same things listed below to merge them, but all outputs just ended up with 0 and 1 in the value field except for the "combine tool". That makes sense to me.

So then I multiplied each one by a unique class number. Now I have 36 rasters that are reclassified, each one contains values of 0 and a corresponding class 1-8. So there are several files that are class 2. Several that are class 8 , and so on. They do not overlap that I know of. I want to get them all into one file with 8 rows, (or 9 rows with the 0 value).If I could even get 36 rows with their reclassed value retained and then use the "lookup tool" to dissolve them that would be ok too. I been googling for hours and have tried everything as follows.

Mosaic to new raster – results in 0 and 1.

Add to raster dataset and calculate statistics – did not work , don't recall why

combine – Can't do all at once, reassigns a new value. Yeah, I could make this work sort of, but no one who opens the file will know what is going on or how to symbolize it.

Raster Calculator – add them together "raster1" + "raster2" etc. Always have an error like something that was not in the input values for example, a row with a value of 16 when no input is over 8.

Raster Calculator – Merge([raster1],[raster2],[raster3]) Error says output raster empty or similar.

Append – The table looks better but the image is a disaster something is totally wrong.Seems to be too many 0 pixels, holes in the image all over.

I have VERY basic python skills and also have ERDAS, if those options offer a solution.

Here it is before I reclassed all the files that were only 0 and 1. This is how I want the final image to look, just in 1 file with 8 classes.

Classified Landcover Image

Best Answer

I was able to use mosaic to new raster. Problem was I needed to set it to "sum" instead of first. Finally, I got classes 1-8. The first time I still had some pixels as 0 and some now as 16.I guessed that some pixels in class 8 overlapped and their sum was 16. I carefully looked back through all the reclassified files. I found that I had used the same input with a value of 8 for two classes. I fixed this, and it solved both the 16 where pixels overlapped and the 0 pixels. In retrospect, using raster calculator "raste1" + "raster2" did work, but I had the same 16 and 0 pixels. If I have time this semester I will revisit con statements to try and make this workflow easier. I looked at it in help, but do not fully understand the syntax.

Related Question