Raster Algebra
The raster algebra engine is a powerful tool for performing virtually any algebraic operations on raster layers with per pixel access. This can vary from a simple sum, in which multiple source layers are combined to form a new layer, to complex expressions using statistics, logical operators, and functions. TatukGIS goes even a step further by integrating vector layers into the raster algebra engine. This enables easily performing tasks such as rasterization of vector layers, selective analysis (i.e., only over the area of a specific object), adding buildings to terrain models, etc.
In keeping with TatukGIS tradition for simplicity of use, the TGIS_RasterAlgebra class exposes only two methods: one adds layers to the engine and the other evaluates the algebraic formula. The raster algebra syntax and features are described in detail (with samples) in the documentation.
The algebra engine is available in the TatukGIS Developer Kernel and desktop GIS Editor (as a plug-in).
As simple example, let's calculate the change in snow coverage of an area over time from satellite imagery. This example uses two layers, 'November' and 'December',
The 'November' layer.
The 'December' layer.
and generates the output to a third layer called
'difference':
difference = RGB( 255 - ABS( november.R - december.R ), 255 - ABS( november.G - december.G ), 255 - ABS( november.B - december.B ) )
The formula is constructed so the greater the difference between the source image pixel values, the darker the result.
The 'difference' layer.
One might ask why the formula is not simply:
difference = november - december
Though the above is a valid formula, it does not yield correct results in this case because:
- the image color is 32-bit ARGB, so the alpha values would also be subtracted,
- the computed result may contain negative values which would cause color artefacts.
Therefore, it is necessary to calculate the difference separately for each RGB channel.
Another use of raster algebra is modifying values in grid data. As a very simple example, let's generate an output layer using grid cell values in a digital terrain layer. We can generate the output based on terrain values that are less than some level (e.g., 1000) by assigning 1000 to any pixel below 1000 and NODATA to all other pixels in the output layer. The terrain layer will be called ‘terrain’ and the output layer ‘flood’:
flood = IF( terrain < 1000, 1000, NODATA )
The pixels of the “flood” output layer with NODATA can be rendered transparent (so if the output layer is positioned over the terrain layer, it does not hide areas of the terrain layer with values of 1000 or greater).
The 'terrain' layer partially covered by the 'flood' layer.
If source images are of different resolutions or coordinate systems - no problem. The algebra normalizes source data to the specifications of the output layer.
Raster algebra functionality is useful to a wide range of industries, particularly those using periodically collected aerial imagery (or other raster data) such as agriculture, forestry, land management, disaster response, environmental, oceanology, meteorology, military, conservation, etc.