Skip to main content
Question

Point Isolator


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

 

4 replies

takashi
Influencer
  • 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
Influencer
  • 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

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings