Skip to main content
Question

Rounding IFMEPointCloud XYZ components with PythonCaller


denisgiannelli
Forum|alt.badge.img

Hello everyone,

In my workspace, I have one point cloud feature (IFMEPointCloud). The points have x y and z components , but many of these points have unnecessary digital precision. My goal is to round all coordinates up to two decimal digits. After reading the FME documentation and checking the FME Forum, it turns out that:

  • "CoordinateRounder" does not work with point cloud datasets;
  • "PointCloudExpressionEvaluator" only rounds float components using ceil and floor expressions, thus resulting in integers.

As a workaround, I am trying to use "PythonCaller" to go through each individual point of the IFMEPointCloud and then round their xyz components. The documentation for IFMEPointCloud is, however, limited, and I don't know how to reach the point/component levels.

Any ideas? Thank you in advance!

2 replies

daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • February 7, 2022

Hi @denisgiannelli​,

You can control the output precision of the @floor() expression by multiplying by 100 before rounding, then dividing by 100:

@floor(@Component(x)*100)/100

 


denisgiannelli
Forum|alt.badge.img

Hi @daveatsafe​ 

Thank you for your answer! Indeed, your suggestion is much more straightforward.

I tried it before, but then it didn't work. Maybe I made a mistake, e.g. the division sign inside the parenthesis. Anyway, now it works. Thanks!


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