Skip to main content
Solved

Compare and filter out line with shorter length


I have duplicate line segments with same unique ID but different lengths. I would like to filter out the shorter line and keep the longer line for further transformation.

Best answer by jdh

Calculate the length, sort your features by length and then use a sampler (First 1 feature), grouped on the Unique ID attribute. The longest lines will be from the sampled port, and the shorter duplicate lines will be sent through the unsampled port.

Alternately use a DuplicateRemover in place of the Sampler.

View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • Best Answer
  • January 14, 2016

Calculate the length, sort your features by length and then use a sampler (First 1 feature), grouped on the Unique ID attribute. The longest lines will be from the sampled port, and the shorter duplicate lines will be sent through the unsampled port.

Alternately use a DuplicateRemover in place of the Sampler.


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • January 14, 2016

If you sort by unique ID and length in desc order then use a duplicate remover, FME will output the longer line via the unique port.


  • Author
  • January 14, 2016
jdh wrote:

Calculate the length, sort your features by length and then use a sampler (First 1 feature), grouped on the Unique ID attribute. The longest lines will be from the sampled port, and the shorter duplicate lines will be sent through the unsampled port.

Alternately use a DuplicateRemover in place of the Sampler.

Thank you !!


  • Author
  • January 14, 2016
ebygomm wrote:

If you sort by unique ID and length in desc order then use a duplicate remover, FME will output the longer line via the unique port.

Thank you.


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