RasterExpressionEvaluator
Evaluates expressions on each cell in a raster, such as algebraic operations or conditional statements.
Input Ports
Features are input through ports A and B. The cardinality of the input is required to be one of the following cases:
- one or more As, no Bs
- one A, one or more Bs
Note that the B port is only visible if
When both A and B features are provided, the single A input will be paired with each B input.
Note the following restrictions on input features:
- Input features must have raster geometry.
- All paired rasters must have the same number of rows and columns.
- Either all bands used in the same expression must have the same nodata value, or all bands used in the same expression must have no nodata value.
- No band may have a palette.
Output Ports
The output of the transformer will be a single raster feature per input pair. The output rasters will have n bands, where n is the number of interpretation/expression pairs, specified through the Band Expression(s) parameter.
Parameters
This parameter specifies how many types of input features are allowed. If One Raster is selected, then only A input features are permitted. If Two Rasters is selected, then A and B input features are permitted.
If any Group By attributes are given, then each group will be treated independently. This allows a single transformer to operate on multiple pairs of As and Bs. Note that this parameter is not applicable when the Mode is One Raster; in that case, each raster is considered individually and there are no groupings.
This table is used to specify how to calculate and interpret one or more bands in the output raster. Each row of the table represents a different band in the output raster.
The first column of the table indicates how each band is to be interpreted. Valid interpretations are Preserve, Auto, Gray8, Gray16, Red8, Red16, Green8, Green16, Blue8, Blue16, Alpha8, Alpha16, UInt8, Int8, UInt16, Int16, UInt32, Int32, UInt64, Int64, Real32, Real64. A value of Preserve means that if all input bands share the same interpretation, the output band will preserve that interpretation. If the input bands do not share the same interpretation, Preserve is the same as Auto. A value of Auto means the output interpretation will be automatically determined based on the data types used to perform the calculations.
The second column of the table indicates the expression used to calculate each output band. A simple expression might be something like "(A[0] + B[0])/2", which calculates the average of the first band of input A and input B. Note that this parameter is case-sensitive.
When pairs of inputs are being operated on (i.e., the expression references both input A and B), the output feature will have all the attributes from both feature A and B. If the same attribute exists on both input features, then the attribute value from feature B will be preferred. Similarly, the output raster will have the properties of raster B. When only a single input is being operated on (i.e., the expression only references input A), the feature attributes and raster properties will remain unchanged.
Usage Notes
Note that when converting between different data types, a Bounded Cast is used. As a result, when a calculated value does not fit in the specified destination interpretation, the corresponding destination value will either be set to the minimum or maximum value possible in the destination data type.
Editing Transformer Parameters
Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, click beside the applicable parameter. For more information, see Transformer Parameter Menu Options.
Transformer Categories
FME Licensing Level
FME Professional edition and above
Search FME Knowledge Center
Search for samples and information about this transformer on the FME Knowledge Center.