Skip to main content

Hello everyone, and thank you for looking!

 

I am asking your help on an operation that I would like to do, but I am unsure how to do it in FME.

 

I have a table such as this:

 

ID AREA VILLAGE

1 232 Oxenfurt

1 452 Las Vegas

1 923 New York

2 124 Jacksonville

2 298 Charlotte

3 767 Las Vegas

3 422 Charlotte

3 223 Oxenfurt

etc...

 

What I want to get is table where ID is unique with a single VILLAGE entry, selected based on the maximum value of the AREA entry, and all other entries with the same ID removed. Taking the above table as example, the result that I would like would be:

 

ID AREA VILLAGE

1 923 New York

2 298 Charlotte

3 767 Las Vegas

etc...

 

How do I achieve this? Note that the input also has polygons, but those do not matter; I want to only have a resulting list of unique ID with the VILLAGE that has the highest AREA only, and delete the others.

 

1. Sort the Features with a Sorter by Area: Numeric Descending

2. Send the Output of this to DuplicateFilter, with ID as the Attribute to test

 

DuplicateFilter will always hold onto the first Feature with the unique Attribute value combination as the "Unique" Feature and all others as "Duplicates". If you use a Sorter to make sure that the Top result you want is the first feature into DuplicateFilter out of a Group of duplicates, then this is what is guaranteed to come out the Unique Port.

 


This is exactly what I wanted. I knew about the existence of DuplicateFilter, but was not aware that it always takes the first entry and deletes the rest. Thank you very much!


This is exactly what I wanted. I knew about the existence of DuplicateFilter, but was not aware that it always takes the first entry and deletes the rest. Thank you very much!

A more general tip with FME is that for many Transformers their behavior and output is dependent on the order that the Features enter the Transformer, so Sorter is a very common Feature Order controller used in front of other Transformers to make sure particular features enter first or last. For example, LineBuilder for controlling the direction of lines generated, AreaOnAreaOverLayer is you set Attribute Accumulation to be "Use Attributes From One Feature" etc. to control which Feature's Attribute values take precedence etc.


Reply