Solved

Is it possible to remove list elements of a feature based on an arithmetic expression (without exploding the list)?

  • 17 November 2022
  • 3 replies
  • 11 views

I have roughly 12.000 features (points). Each feature has a list with 400 elements, which all have an X and Y attribute. I would like to remove the elements of which the distance between the point of the feature and the element attributes is bigger than a certain number.

 

Currently I'm first exploding the list, and then using a tester with the arithmetic expression(@sqrt(@pow(@XValue()-@Value(x_end),2) + @pow(@YValue()-@Value(y_end),2))).

 

The problem is that this way I first explode the list, which results in more than 4 million features! If I could eliminate them before exploding than I would only have roughly 200.000, which would improve performance.

 

 

icon

Best answer by david_r 17 November 2022, 17:07

View original

3 replies

Userlevel 4

To me this would definitely be done in a PythonCaller. Exploding features is very costly (performance-wise), and reducing the list in Python would avoid that.

Badge +10

To me this would definitely be done in a PythonCaller. Exploding features is very costly (performance-wise), and reducing the list in Python would avoid that.

Second that, my main driver for learning to use python in FME was to avoid exploding lists

Badge +2

@nibon​ it might be better to look at why you have ~400 elements in the list in the first place and try and reengineer that part of your workflow. Otherwise PythonCaller is probably your friend as @david_r​  suggests. Very simple example of Python lists and FME list attributes here (towards the end)

Reply