Subtract lines in QGIS

Let's assume that you want to remove overlapping lines in QGIS:

Subtract two lines in QGIS

Vector > Geoprocessing Tools > Symmetrical difference

Symmetrical difference in QGIS

If there are several geometries in both layers, you might get an error when using the previous tool. In such cases, I recommend creating a buffer of a few meters for each line.

Vectorial > Geoprocessing Tools > Buffer with fixed distance

Create buffer both lines QGIS

Now, use the symmetrical difference tool again, and you'll get something like the following:

Symmetrical difference in QGIS with buffer

Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.