Skip to main content
Solved

Compare and filter out line with shorter length

  • January 14, 2016
  • 4 replies
  • 119 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.

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+37
  • Contributor
  • 2002 replies
  • 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+44
  • Influencer
  • 3427 replies
  • 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
  • 9 replies
  • 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.

Thank you !!


  • Author
  • 9 replies
  • 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.

Thank you.