Hi, @david_r help find a solution. I have a long line with a large number of segments, how could I extend the last sides of it, with the same angle, till the first intersection with another line or edge of the polygon.
Sorry, this is something I have practically no experience with. But if you look around for undershots, you'll find some stuff that might be helpful. For example:
https://hub.safe.com/publishers/safe-lab/transformers/smartcleaner_2013
https://community.safe.com/s/article/data-qa-identifying-undershoots-and-overshoots-in
Hopefully someone else can chime in as well.
Get a common ID for line and polygon (maybe SpatialFilter), extend lines via LineExtender then use Clipper with polygons as clippers and lines as clippees with GroupBy enabled on the common ID.
To figure out a useful extend length (not to big that you get artifacts from overextended lines that ) you could use 2 CoordinateExtractors in series, one set to Index 0 and one to Index -1 (start and end points), create vertex from them, use NeighborFinder with GroupBy set to the common ID, use StatisticsCalculator to get max _distance for each line, merge your new point attributes with the lines and then extend by _distance.max.
Or you could put the values for index 0 and -1 _distance in different attributes and extend Begining by 0 attribute and End by -1 attribute in serialized LineExtenders. And the clip.
Or you could try an iterative approach in which you you extend by a small amount, clip with GroupBy and repeat until you get your desired result.
It's not easy and you may not get a desired result. The articles that @david_r pointed out could be a starting point for you.
Thank you @david_r and @caracadrian your post pushed me to solve this problem