2

I would like to cut a line layer using a polygon in one single step in QGIS. There is a solution to do that in more steps: First, using Intersect function, line portions that fall within the polygons will be added to one resulting layer. Using Difference, all other parts that don't fall within any polygon will be another layer. Finally, merging these two layers gives the result I need.

Is there a way to do this in one step?

Beginning: One feature enter image description here

Result: Three features enter image description here

1

The combination of Intersection and Difference tools could be very time consuming when managing large vectors (especially polygon layers).

I don't know if it possible by now to accomplish your task in one step, but you may decrease the execution time of the analysis using a two-steps approach.

Starting from this:

enter image description here

  1. Use the Polygons to lines tool from the Processing Toolbox:

enter image description here

  1. Use the Split lines with lines tool from the Processing Toolbox:

enter image description here

NOTE In the few tests I have done, sometimes one (or more) feature was created in correspondence of the intersection between the original line and polygon: I sincerely don't know why this happens and if it depends from something in particular, but I report this behavior for the sake of clearness (I don't know if this could be a problem for you because you may easily delete these empty geometries further).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.