I'm trying to use FME to do some raster algebra for some Multi-Criteria Analysis. At the moment, I have three rasters, all with the same extents and resolution: Slope, Hydro, and Infrastructure Mask. In the future, I will be adding additional layers (Vegetation, for example).
The slope raster is a classified raster representing low to high slope. The categories are:
- 5: Less than 5 degrees (Preferrable)
- 2: 5-10 degrees
- 1: 10-15 degrees
- 0: Greater than 15 degrees (undesirable - No Go)
The Hydro raster is a classified raster of buffer distances from waterways. The categories are:
- 5: Within 50m of a waterway
- 4: Between 50-100m of a waterway
- 3: Between 100-500m of a waterway
- 2: Between 500-1000m of a waterway
- 1: Greater than 1000m of a waterway
The infrastructure mask has a value of 0 wherever there is some kind of infrastructure (Road, Pipeline, Powerline, Well, etc) and a value of 1 everywhere else.
I would like to combine the Slope and Hydro (and eventually other layers) using FME. Ideally, I would like to add the values together, except, if the slope has a value of 0, the resulting raster should be zero. For the moment, I am using a RasterExpressionEvaluator Transformer to combine the layers, but I'm not sure of the right syntax to get what I want.
This is the expression I'm using:
A is the Slope Raster and B is the Hydro Raster. Hydro_Weight and Slope_Weight are parameters that the user enters before running the workspace. Essentially, what I'm doing is: if the slope is 0, then the result should be 0, otherwise, add the weighted values of the slope and hydro rasters. This seems like the correct way to go but all the cells in my output have a value of -128.
Is this the correct way to use the RasterExpressionEvaluator?