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.

enter image description here

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?

  • Would you need to use the RasterCellValueCalculator first? A screenshot of the workspace might help. – Mapperz Jun 10 '14 at 14:35
  • @Mapperz, I don't want to add the two rasters if the cells in the classified slope raster has a value of zero. If it doesn't, then I want to add them with their associated weights. RasterCellValueCalculator will add them unconditionally. Also, I don't think a screenshot of the workspace will help. Just imagine two raster feature types coming in and going to a RasterExpressionEvaluator transformer. That's as far as I've gotten. – Fezter Jun 11 '14 at 6:32
  • Did you get this working? If not, I wonder if breaking the expression down and building from scratch would help to identify where the problem lies. For example, start with "if(A[0]==0,0,1)" then maybe "if(A[0]==0,0,B[0])" and so on. Then you'd at least be able to find what part is causing the issue. My money is on either the weighting part causing a problem, or something later in the workspace. – Mark Ireland Jun 24 '14 at 20:05
  • @Mark, I had tried several variations of breaking the expression down. I had even tried your exact examples with no luck. I assumed I was using the transformer incorrectly. There really isn't anything else in the workspace. Just the two rasters and the transformer. This particular project has been put on hold for the time being (client hasn't paid us yet). We're not convinced that FME is the right tool for the job anyway. We may invest in ESRI Spatial Analyst. Mark, perhaps Safe could provide some more online tutorials for this kind of work. – Fezter Jun 25 '14 at 2:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.