Using Binary Math for Combining Rasters
Back
to the
GIS Tutorials & Help
Page...
Back to the
SAL Home Page...
Binary Rasters
A common technique for combining raster datasets is to set each raster to values of 0 or 1 and then use simple raster algebra to combine the two rasters. For example, to find areas of high elevation (say above 1,000 m.) and south facing slopes:
Reclassify the elevation raster:
0 for everything below 1,000 m.
1 for everything above 1,000 m.
Reclassify the aspect raster:
0 for slopes facing E, W, N, NE or NW
1 for S, SW or SE facing slopes
Add the two new rasters together
In the resulting raster cell values will be 0, 1 or 2:
0 = low elevation, not south facing
1= either high elevation or south facing (but not both)
2 = both high elevation and south facing
Alternatively, the two rasters can be multiplied (instead of added)
In this case, the output is again a 0/1 binary raster:
0 = either low elevation or not south facing or neither
1 = high elevation and south facing
This basic concept can be extended to multiple rasters (including a landcover or riparian buffer raster for example).
~ ~ ~ ~ ~
Retaining More Detail with Binary Numbers
One of the downsides of the above technique, especially when dealing with more than just two rasters, is the loss of information regarding the inputs when considering the final raster. If using the addition method you end up with values of 0, 1 or 2. A result of 0 or 2 provide clear results, but a value of 1 could be either low elevation or not south facing, with no means of distinguishing between these two possibilities. Likewise, with the multiplication method, there is no way of determining which of three possible input options (low elevation, non-south facing slope, or both) produced a value of 0.
These problems can be eliminated by not simple using 0's and 1's for each input raster. Returning to the high elevation and south facing example from above:
Reclassify the elevation raster:
0 for everything below 1,000 m.
1 for everything above 1,000 m.
Reclassify the aspect raster:
0 for slopes facing E, W, N, NE or NW
2 for S, SW or SE facing slopes
Add the two new rasters together
In the resulting raster cell values will be 0, 1 or 2:
0 = low elevation and not south facing
1= high elevation but not south facing
2 = south facing but low elevation
3 = high elevation and south facing
Note that the resulting raster now contains not only the areas meeting the original criteria, but also all of the possible combination of inputs. If additional rasters need to be combined they can be assigned increasingly high numbers using a binary progression of numbers (1,2,4,8,16,32,64,128, etc.). Extending the example to include forest landcover:
Reclassify the elevation raster:
0 for everything below 1,000 m.
1 for everything above 1,000 m.
Reclassify the aspect raster:
0 for slopes facing E, W, N, NE or NW
2 for S, SW or SE facing slopes
Reclassify the landcover raster:
0 for everything not forest
4 for forest
Add the two new rasters together
In the resulting raster cell values will be 0, 1 or 2:
0 = low elevation, not south facing and not forest
1= high elevation but not south facing and not forest
2 = south facing but low elevation and not forest
3 = both high elevation and south facing, but not forest
4 = forest but low elevation and not south facing
5 = forest and high elevation but not south facing
6 = forest and south facing but low elevation
7 = high elevation, south facing and forest
Back
to the
GIS Tutorials & Help
Page...
Back to the
SAL Home Page...