2

I have a "sites" vector layer with 300 polygon features and a "heathland" vector polygon layer, showing the locations of heathland areas. I am looking for a way to select all features in the "sites" layer that overlap or overlay a minimum area of 30 hectares of the heathland layer. I know how to select features that contain only/no/any heathland using the Select by Location tool, but I don't know how to specify a minimum area.

Is there a specific expression or tool in QGIS that allows me to perform this selection based on the minimum overlap area? ChatGPT gave me the following expression, which maybe should work theoretically but unfortunately, it crashes my QGIS! ("not responding" forever)

aggregate(
    layer:='heathland',
    aggregate:='sum',
    expression:=area(intersection($geometry, geometry(@parent))),
    filter:=intersects($geometry, geometry(@parent))
    ) >= 300000

Can you any guidance on either:

  1. constructing the appropriate expression or using a particular tool. or
  2. how to prevent QGIS from crashing when using the above expression. It works fine and quite fast on my PC otherwise. My layers have spatial indices.

Is there any other way to speed up/improve performance?

2
  • You might instead consider an overlay to produce a new layer, with the overlaps cut into the result, recalculate the areas and then select for 30 hectare polys with attributes from both layers. You can use that layer or join it back to your original and select based on the join.
    – John
    Commented Dec 1, 2023 at 16:56
  • @John, that was a good idea, and works well for my purpose. Thanks!!
    – nn90
    Commented Dec 2, 2023 at 16:45

0