3

I have two line layers, A and B.

Layer A is sort of a complete network (black lines on the screenshot below), layer B contains certain chunks from layer A (red and light blue lines on the screenshot).

Now I wanted to clip both line layers, to get the line parts of layer A (black) that are not in layer B.
I have tried all the geoprocessing tools in QGIS, but none yielded the result I wanted.
Internet research only covers polygon-polygon or polygon-line clipping, but how do I do line-line?

Important: The single features of the "black" layer are not necessarily the same ones that are red/light blue in layer B, because they have been merged or cut into new pieces, but the geometry remained the same.

On the image below, Layer A (black lines), also covering the traces of Layer B (red and light blue).

example

1

I don't have access to QGIS right now to check, but I think you can use the Difference tool to cut the Layer B lines out of a polygon. You would then use the Difference tool again with this cut polygon and the Layer A lines to erase what you don't need.

  • Great idea! Unfortunately I keep getting geometry errors when I try to use the difference tool with a (temporary) polygon layer and the layer B...but i think the concept might lead to the solution! – Kai Aug 21 at 21:49
  • Confirmed - QGIS/Difference will work with line geometries. – GBG Aug 21 at 22:45
-1

There might be some errors about topology because sometimes lines are not connecting with each other similar to ArcGIS where you may need to manually drag some lines to correct it.

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.