the objective of the workbench is to cut objects in order of priority according to the values of the attributes. The priority has to be fixed automatically.
I first generate a table that looks like this:
The objective is to autmacitally generate the order of clipping in a table :
I don't know how to solve this problem, can anybody help me?Thank you
Ronan
Best answer by tomf
OK - found a bit of time before finishing.
Similar to before , at least to start with.
Having aggregated the features, grouped by ID, as earlier we then sort the list (just so ensure elements are in lowest to highest order )
Next concatentate the list with no seperator (e.g. [a, b, c, d] -> abcd) as IDs
At the same time calculate the maximum length of all the lists.
Unconditionally join the max length back onto all features
Then create a sort attribute from the IDs zero-padded to the right to the max list length
Sort the features by the sort attribute (numeric ascending)
Finally tidy up the lists and temporary attributes and create Order as before.
@ronan This can be achieved with a few transformers. In the solution I've assumed that the "Order" is the number of elements in "ID clipped" largest to smallest. These instructions will take you from your first table to the second exactly.
Firstly use an Aggregator (Group by "ID") to reduce the number of features to one per "ID". In the Aggregator's parameters, concatenate "ID referred" using ", " (<comma><space>) as the separator, and create a list of "ID referred"
Then count the elements of your list using a ListElementCounter
Then sort the features on _element_count (numeric descending) in a Sorter
Finally drop any temporary attributes/lists not required and create "Order" as @Count() (indexed at 1)
Have attached workspace built in FME 2020.2.2 to demonstrate this.
The problem is that there is not always a link between the number of element of ID and the priority. This method is working on the example I provided, but it won't work on another exemple.
I the method should take into account ID 1 has priority over ID 2 AND ID 1 has priority over ID 2...
The problem is that there is not always a link between the number of element of ID and the priority. This method is working on the example I provided, but it won't work on another exemple.
I the method should take into account ID 1 has priority over ID 2 AND ID 1 has priority over ID 2...
I think I see what you are getting at. If an ID has priority over another it comes first, so an ID must come before all values in it's list. So ID = 1 must come before IDs 2, 3, and 4. ID = 2 only comes before 4 and ID 3 must come before Ids 2 and 4. Therefore the order must be 1, 3, 2, 4.
Let me know if that's right.
It's the end of the day here, so I'll get back to you later but I feel a solution is possible
I think I see what you are getting at. If an ID has priority over another it comes first, so an ID must come before all values in it's list. So ID = 1 must come before IDs 2, 3, and 4. ID = 2 only comes before 4 and ID 3 must come before Ids 2 and 4. Therefore the order must be 1, 3, 2, 4.
Let me know if that's right.
It's the end of the day here, so I'll get back to you later but I feel a solution is possible
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.