# RasterExpressionEvaluator

Evaluates expressions on each cell in a raster or pair of rasters, including algebraic operations and conditional statements.

### Typical Uses

• Performing calculations on rasters or pairs of rasters
• Manipulating images
• Combining rasters
• Classifying rasters

## How does it work?

The RasterExpressionEvaluator receives raster features and evaluates defined expressions using the cell values, then outputs new raster features with the calculated values.

### Input Mode - One or Two Rasters

The transformer has two modes - One Raster and Two Rasters.

One Raster mode provides a single input port -the A port. In this mode, expressions will be evaluated wholly within a single raster.

Two Rasters mode provides two input ports - A and B. In this mode, expressions can use cell values from two rasters of the same dimensions (same number of rows and columns). Position information for georeferenced rasters is not taken into consideration. The number of input raster features may be:

• If One Raster (A) - one or more A raster, no B rasters.
• If Two Rasters (A and B) - one A raster, one or more B rasters. The single A input will be paired with each B input.

All bands used in the same expression must have the same Nodata value, or have no Nodata value at all. No band may have a palette.

In Two Raster mode, if an expression references both the A and B input raster features, the output raster 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.

When only a single input is being operated on (for example, in One Raster mode or if the expression only references input A), the feature attributes and raster properties will remain unchanged.

### Expressions

Expressions are defined in the Band Expression(s) table. Each line in the table corresponds to one band in the output raster, in sequential order - that is, the first line produces Band 0, second line produces Band 1, and so forth. The Interpretation Type for each output band is also specified here.

Expressions may be as simple a constant value or simple arithmetic operation. The Arithmetic Editor - Raster Expression is available via the Expression ellipsis (...) button to assist in the construction of expressions.

Expressions are case-sensitive.

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. For example, a value of 300, if converted to an unsigned 8-bit integer band, would become 255 (the maximum available value for that interpretation type).

Nodata and Zero (0) Values: Expression evaluation often involves changing interpretation types of values, and can sometimes result in unpredictable behavior particularly in the case of zero (0). When defining your expression, best practice is to specify zero in decimal form as 0.0 to avoid it being misinterpreted as Nodata.

## Usage Notes

### Choosing a Raster Transformer

FME has an extensive selection of transformers for working with raster data. They can be generally categorized as working with whole rasters, bands, cells or palettes, and those designed for workflow control or combining raster with vector data.

For information on raster geometry and properties, see Rasters (IFMERaster).

## 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.

### Defining Values

There are several ways to define a value for use in a Transformer. The simplest is to simply type in a value or string, which can include functions of various types such as attribute references, math and string functions, and workspace parameters. There are a number of tools and shortcuts that can assist in constructing values, generally available from the drop-down context menu adjacent to the value field.

### Dialog Options - Tables

Transformers with table-style parameters have additional tools for populating and manipulating values.

## Reference

 Processing Behavior Feature Holding Yes Dependencies None Aliases History

## FME Community

The FME Community is the place for demos, how-tos, articles, FAQs, and more. Get answers to your questions, learn from other users, and suggest, vote, and comment on new features.

Search for all results about the RasterExpressionEvaluator on the FME Community.

Examples may contain information licensed under the Open Government Licence – Vancouver and/or the Open Government Licence – Canada.