Solved
Does anyone know how you merge lines with the same ID together but hold the attributes from the line with the longest length?
Does anyone know how you merge lines with the same ID together but hold the attributes from the line with the longest length?
Best answer by redgeographics
First use a LengthCalculator to calculate the length of every line. Then for the merging you can use an Aggregator or LineJoiner (depending on what your geometry looks like and how you want to merge it. These transformers will have an option to create a list, that's a 1-to-many relationship, so the resulting lines will have a list with all the attributes of all their component lines. You can use a ListSorter to sort that list on the length attribute and then a ListIndexer with the index set to 0 to grab the attributes out of the first list element and promote those to feature attributes.
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.
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.



