Combine multiple binary rasters to a single raster

I have 5 different species richness maps which I am trying to join in order to show one cohesive map. Each species raster layer has values of 1 and 0; 1 if the species lives there and 0 if the species does not.

In other words, I want something like this:

``````if species 1==1,1
if species 2==1,2
if species 3==1,3
``````

And so on until I reach 5. I want everything else to be classified as a 0.

I am very new to using raster calculator and am unsure how to set this up.

I just realized that this will not work since the species will overlap. I will need to figure something else out.

• Since there are raster calculators in different softwares, you'll need to specify which software you are using in order to get help. Per your edit, if you wish to withdraw the question you'll need to actually delete it. Apr 17, 2015 at 23:43
• @ChrisW It will work with such a limited subset of species. Apr 17, 2015 at 23:50
• @nagytech Per your answer, yes. But you might want to add a how to reclassify values step to your answer, since if the data is currently 0 or 1 that will have to happen first before you can use the bitwise algerbra. Apr 17, 2015 at 23:53
• @ChrisW I'm simply giving direction as to the most applicable options. If someone else wants to do the hand-holding then they are welcome to receive the merit for doing so. Apr 18, 2015 at 0:01

That's a simple add raster calculation. You just add them all together (r1+r2+r3+r4+r5) and the result is a raster where the value indicates how many species are present at each cell. You can't differentiate species, but that wasn't part of the original question.

If you want to do that, you need to use something like the Combine tool in ArcGIS (Spatial Analyst). This will create a new raster with a unique value for each unique combination of values in the inputs. That unique value, if properly keyed, will identify which species are present in combination based on the unique values.

I'm not sure how practical this is for your given requirements, but you can try bitwise algebra. Given that you have a limited number of species, it might work.

Bitwise algebra would work where the species are all represented by either 1, 2, 4, 8, 16, or a combination of those. For example, is species 1, 3 and 4 exist the cell would be represented by `1 + 4 + 8 = 13`. You can then use further bitwise operations to reverse that query. Example `13 AND 1 = 1`, `13 AND 4 = 4`, `13 AND 2 = 0`. Where the evaluation of a bitwise AND is `> 0`, the test for comparison is true.

You can read more on ESRI's implementation of bitwise here. The ESRI Raster Calculator has bitwise operators. Most other GIS tools should have them as well.

However, given that you will eventually encounter a scenario where you will have more numerous species you might want to think of another method. Ideally, from an ecological perspective, you would need to identify specific groups of communities, or biodiversity categories to represent the combinations of data. (See ChrisW's answer on using the Combine tool)

Alternatively, you would want to keep your layers separate and build a system around it that queries each layer independently if you can't establish categories.