Question

Rounding IFMEPointCloud XYZ components with PythonCaller

  • 7 February 2022
  • 2 replies
  • 12 views

Badge

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

Userlevel 2
Badge +17

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

 

Badge

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!

Reply