Skip to main content
Question

Error with multiple if statements in RasterExpressionEvaluator?

  • April 24, 2014
  • 5 replies
  • 99 views

makt
Contributor
Forum|alt.badge.img+1
I am trying to follow the example here (http://fmepedia.safe.com/articles/How_To/Advanced-cell-color-manipulation-with-RasterCellValueReplacer-and-RasterExpressionEvaluator-dealing-with-color-no-data-values) , which states:

 

 

"Another, more efficient way to change 0,0,0 to 255,255,255 without altering values like 0,0,255.

 

 

All you need is a RasterExpressionEvaluator with an expression set to:

 

if ((A[0]+A[1]+A[2])==0, 255, A[0]); if ((A[0]+A[1]+A[2])==0, 255, A[1]); if ((A[0]+A[1]+A[2])==0, 255, A[2])"

 

 

however, if I insert  that expression into RasterExpressionEvaluator I get this error:

 

"RasterExpressionEvaluator(RasterEvaluationFactory): The INTERPRETATION_LIST clause has 1 entries, whereas the EXPRESSION_LIST clause has 3 entries.  These clauses must have an identical number of entries"

 

 

Is something wrong with the example, or did I misinterpret how I am supposed to implement it?

 

 

Also, is the language being used here TCL? (I could not find any TCL statement on Google that looked similar in style)
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

takashi
Celebrity
  • April 25, 2014
I think the documentation has not been updated. Maybe it's applicable to FME 2012 and earlier.

 

In FME 2014, you can specify expressions for each band separately like this.

 

 


makt
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • April 25, 2014
Thanks! is the code being used here TCL?

makt
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • April 25, 2014
I noticed that the expressions also seem to work without the "@" symbol in the front of the if statments - what is the @ refering to here?

takashi
Celebrity
  • April 26, 2014
The expressions should be written in FME specific syntax. You can see and choose available parameters, math functions and operators in the Raster Expression editor. Math functions and operators are similar to ones of C language (but are not completely same).

 

See also the help documentation of the ExpressionEvaluator. There are descriptions about almost all the math function and operators.

 

 


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • June 23, 2014
The example expression should work on 1 line.

 

I think you chose the wrong intepretation for your inputraster. You might want to reinterpretate the input. (or use seperate lines for the expressions of course)