Skip to main content

Hi,

 

I was wondering of it is possible to use an if statement in the Pointcloudexpressionevaluator to calculate values based on values of other components.

 

I created a pointcloud with different z components (for example z_2018_01 and z_2018_02), these z values represent measures in different months in 2018 . There are also components that represent the year and month (YM_2018_01 filled with value 20801 and YM_2018_02 filled with value 201802)

 

There are also points that have only one measure value (or in period 1 or in period 2), see table below. From these z components I want to calculate a z_actual (most recent z value). Is there a way to use the Pointcloudexpressionevaluator?

 

An expression like : “If JM_2018_02 > JM_2018_01 then z_2018_02 else z_2018_01” will be useful but I don’t know of this is possible, and if, how to build such an expression in the Pointcloudexpressionevaluator. Can anyone help me? I prefer the pointcloud transformers because it gives a very good performance, (most of the source files contains up to 100 million points!).

 

x

y

z_2018_01

z_2018_02

JM_2018_01

JM_2018_02

Z_actual

x_value

y_value

-10,4

-10,2

201801

201802

10,2

x_value

y_value

 

-11,6

0

201802

11,6

x_value

y_value

-9,4

 

201801

0

9,4

x_value

y_value

-4,2

-4,1

201801

201802

4,1

x_value

y_value

-10,3

 

201801

0

10,3

 

Another issue is the possibility to do average calculations with the Pointcloudexpressionevaluator. For average calculations I need to ignore the 0 values in the first 3 z columns (see table below), at the moment I use this expression :

(@Component(z_2018_01)+ @Component(z_2018_02)+ @Component(z_2018_03))/3 that results in some cases in an incorrect average (see z_averge1 in the table below). Values in z_average2 represent the correct averages calculated without the ignored 0 values. Is there a way to do a correct calculation with the Pointcloudexpressionevaluator?

 

x

y

z_2018_01

z_2018_02

z_2018_03

z_average1

z_average2

x_value

Y_value

-10,2

-10,1

-9,9

-10,07

-10,07

x_value

Y_value

0

-11,5

-11,9

-7,80

-11,70

x_value

Y_value

-12,7

0

-12,9

-8,53

-12,80

x_value

Y_value

-17,4

-18,1

-17,2

-17,57

-17,57

x_value

Y_value

0

0

-6,9

-2,30

-6,90

 

Hi @poppendamme,

Looking at the PointCloudExpressionEvaluator, it looks like you can set conditional values as the Expression by selecting the empty expression cell, then clicking on the drop-down arrow, then selecting Conditional Value. You can learn more about setting conditional values on the Testing with If-Then Conditional Statements article or in the Parameter Condition Definition Dialog documentation.

The Parameter Condition Definition allows you to define multiple if/else if and an else test. Here is a quick video showing how to set up a sample value: https://www.screencast.com/t/a2GhgYrxZ

As for ignoring the 0 values, you may need to want to consider setting up composite tests to ignore unwanted values or calculate this average value separately into a new attribute which could be used in the PointCloudExpressionEvaluator. You can learn how to set up composite tests in the Tester and TestFilter section of the FME Desktop Training Manual under the multiple clauses heading.

I hope this information helps.


Reply