1

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

1
  • 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? Commented Apr 16, 2021 at 11:58

1 Answer 1

3

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

SELECT lines.* FROM "Layer 1" lines, "Layer 2" structure, WHERE NOT( 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.

1
  • Thank you! It worked. Commented Apr 19, 2021 at 7:44

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.