Skip to main content
Question

Point Isolator

  • June 12, 2013
  • 4 replies
  • 22 views

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

 

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.

4 replies

takashi
Celebrity
  • June 12, 2013
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

david_r
Celebrity
  • June 13, 2013
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

takashi
Celebrity
  • June 13, 2013
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

  • Author
  • June 13, 2013
Thanks for all your help