I'm new to FME and I’m reading in a CSV file then using 3DPointAdder. Now I need to isolate points that are divisible evenly by 0.25 so I can add a constant to the Z value then merge them back with the other points to create a new CCV file. Please Help. THANKS
Page 1 / 1
Hi Ted,
I assume there are (x, y, z) in a line of the source CSV file. But, sorry, I don't see clearly what is the condition to isolate (classify?) those points. Could you explain about that in detail a little more?
> that are divisible evenly by 0.25
Takashi
Hi,
you can check if a floating point number is evenly divisible by 0.25 using the following expression in an ExpressionEvaluator:
(round(@Value(MyFloatAttribute)*1000.0) % round(0.25*1000.0) == 0) ? 1 : 0
It will return the value 1 if it is evenly divisble by 0.25, otherwise it will return 0.
(The trick here is to convert the floats to integers to avoid accuracy problems, using a multiplier an order of magnitude larger than the resolution of our calculation, here 1000.0)
David
I got it, you want to treat every point whose z value is divisible evenly by 0.25. I missed z value...
The way suggested by David would work well. And if the actual data condition allows to ignore the accuracy problems, you also can consider using @fmod function in the ExpressionEvaluator: @fmod(@Value(z),0.25) This expression returns 0 when z is divisible evenly by 0.25. In addition, if your purpose is only to write the calculation result into a new CSV file, I don't think you need to replace the source (x, y, z) with a Point geometry using the 3DPointAdder .
Takashi
Thanks for all your help
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.