Skip to main content
Solved

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

  • November 17, 2022
  • 3 replies
  • 142 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.

 

 

Best answer by david_r

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.

View original
Did this help you find an answer to your question?

3 replies

david_r
Evangelist
  • Best Answer
  • November 17, 2022

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.


ebygomm
Influencer
Forum|alt.badge.img+32
  • Influencer
  • November 17, 2022
david_r wrote:

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


Forum|alt.badge.img+2
  • November 17, 2022

@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)


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