I have two QGIS layers. Layer 1 has a floor plan with an attribute field holding feature types, e.g., wall, corridor etc. Layer 2 consists only the lines drawn between door centroids. I want to query the lines in Layer 1, which cross a wall or corridor from Layer 2, then delete these lines.

How would this be done using QGIS?

This is what I have:

enter image description here

and this is what I want to have:

enter image description here

  • If you select wall lines by an expression, then use the select by location on your door centroid lines with that wall selection, will that select the door lines you want? – johns Apr 16 at 11:58

With a virtual layer (official documentation), you can create a new layer then save the result as :

SELECT lines.*
  "Layer 1" lines,
  "Layer 2" structure,
    structure IN ('wall', 'corridor')
    AND ST_INTERSECTS(structure.geometry, lines.geometry)

or in QGIS create a selection in Layer 2 with an expression like type IN ('wall', 'corridor'), select all features in Layer 1, and with the tool select by location (documentation), you can remove selection from Layer 1 that intersects selected features in Layer 2.

Then, toggle edit mode in Layer 1 and delete selected features.

  • Thank you! It worked. – mdgcrks Apr 19 at 7:44

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.