What seemed to be an easy task turned out to be not that easy.
I want to measure line length in separate polygons.
My steps so far:
- polygons to lines (because intersecting lines with polygons ends up in lineends out of the polygons get deleted, same behaviour like clip btw. not logic for me)
- split lines with lines (polygon lines with actual line layer)
- save intersection (because you cant apply a virtual layer on a temporary layer)
- calculate line lengths (lines splitted need new line lengths)
- Run the virtual layer with st_within OR select by location with "within", select splitted line layer with polygons one by one.
And here strange things happen: The lines, cutted with the lines from the polygon, still dont get correctly selected at the boarders. I get one half, but not both of the cutted lines.
Like, one part of the splitted line isnt within the polygon. But i cutted them with the boarders of the polygon and didnt move them.