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.
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.
Do not forget to recalculate the length (if you want that attribute) after the merging as the calculated length will only represent one of the merged parts.
Do not forget to recalculate the length (if you want that attribute) after the merging as the calculated length will only represent one of the merged parts.
Ah yes, good call!
Thx! It works perfect!
Hi there, by any chance, does anyone know how to do this in a way that doesn't result in overlapping multi-part features?
I'm trying to create a model that joins two datasets that share some identical features in common.
When I use Line Joiner grouped by their common ID field, either nothing happens or one of the matching features seems to become corrupted (is not visible in ArcMap unless you manually edit its vertices).
When I use Aggregator, I get multipart features with two identical parts.
In both cases, I've compared the exact coordinates of every vertex in a sample of the resulting features, and they're completely identical.
I've attempted both methods with multiple unrelated datasets and have received the same results.