Apply a map algebra script on a raster. The expression can be a simple arithmetic operation or a complex combination of multiple operations. The expression can be applied to a single raster band or multiple raster bands. The result of the expression is a new raster.Documentation Index
Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
Use this file to discover all available pages before exploring further.
RS_MapAlgebra is backed by Jiffle and can be compiled to Java bytecode for execution. For guidance on scripting for map algebra, refer to the Jiffle language summary.
The
RS_MapAlgebra function can cast the output raster to a different data type specified by pixelType:-
If
pixelTypeis smaller than the input raster data type, narrowing casts will be performed, which may result in loss of data. -
If
pixelTypeis larger, widening casts will retain data accuracy. -
If
pixelTypematches the input raster data type, no casting occurs.
Signatures
Single raster input
Two raster inputs
Parameters
The input raster to apply the map algebra expression to. In the script, the
rast variable is bound to this raster.The first raster to apply the map algebra expression to (for two raster input signatures).
The second raster to apply the map algebra expression to (for two raster input signatures).
The data type of the output raster. Accepts one of:
D (double), F (float), I (integer), S (short), US (unsigned short) or B (byte). If specified NULL, the output raster will have the same data type as the input raster.The map algebra script written in Jiffle. The
rast variable (or rast0/rast1 for two raster inputs) is bound to the input raster(s), and the out variable is bound to the output raster. Use bracket notation to access bands, e.g. rast[0] for the first band.The nodata value of the output raster.
null is allowed.The number of bands in the output raster. When specified, the output bands can be referenced in the script using
out[0], out[1], etc.Return type
The resulting raster.

