Skip to main content
Solved

Compare and filter out line with shorter length

  • Jan 14, 2016 3:48 PM UTC
  • 4 replies
  • 192 views

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
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, 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+41
  • Contributor
  • Best Answer
  • Jan 14, 2016 3:55 PM UTC

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
Evangelist
Forum|alt.badge.img+54
  • Evangelist
  • Jan 14, 2016 3:56 PM UTC

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
  • Jan 14, 2016 4:06 PM UTC

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
  • Jan 14, 2016 4:06 PM UTC

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.