The attached workbench should give you the desired results. To sum it up:
- Archive the original geometry of the lines
- Split the lines per the polygons, which merges the code onto the lines
- Calculate the length, and find the max length
- Test for length equaling the max length, keeping those.
- Replace the geometry with the archived original geometry.
(If you already have a unique ID on the lines, you can use that instead of creating one in the Counter transformer. You will just need to update the StatisticsCalculator to your unique ID.)
Thank you, this is very useful!!
Hello @dustin ,
I have a few questions about the workbench:
do I have to add 1 file geodatabase to the reader where the polygons and the lines are located?
do you have the parameters for the LengthCalculator? I had to re-add this.
where can I find my output data? Because there is no writer.
thanks in advance,
Bas
@bascopier Yes. You will need to add your geodatabase reader feature types, feeding your lines and polygons as I did my test data. The LengthCalculator used the default settings (_length). You will need to add a writer for the format you are wanting to write to, which will go right after the GeometryReplacer (instead of the Inspector I was using for testing)
@dustin so i have 1 geodatabase that includes the lines ánd the polygons and use this for both readers (lines and polygons).
When you read in the geodatabase, it will read in both the line and polygon feature classes (whatever your feature classes are named, not necessarily 'line' and 'polygon'). The lines would be fed into the Counter, polygons would be fed into the area port of the LineonAreaOverlayer.