Skip to main content

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.

 

 

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.


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


@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