4

Backgound:

At 3.34.2, consider a scenario involving two polygon layers, as shown in the diagram below. The task is to select by location polygons from Layer A, compared to Layer B, that return only polygon #3.

Polygon #3 is unique because it is completely within a Layer B polygon, yet it shares no vertices or edges with that polygon.

I've tested every checkbox option in the Select by Location tool. None of them will return just polygon #3. For example, the "are within" option selects all three polygons.

I've also experimented with the "overlay" expressions, such as overlay_within('Layer_B'), but without success.

I also tried the "Select Within" plugin, but it was not able to select just Polygon #3.

Question:

How to select polygons from one layer that are completely inside polygons from another layer, yet have no vertices or edges in common.

Bonus points for techniques that would select Polygon #1, as well as Polygon #2!

enter image description here

1 Answer 1

6

You could add an extra clause to check if the polygon from Layer A intersects the boundary (a line) of Layer B.

overlay_within('Layer B') 
and not 
intersects(@geometry, boundary(aggregate('Layer B', 'collect', @geometry)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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