2

I'm using QGIS 3.14.11, and I want to compute the area covered by a layer on a grid, aiming to erase the grid cells that are covered over 90%.

I've tried before to use cut or intersect, but it didn't work. Intersect created polygons that didn't match my request (from the grid cell cutting point of view) and cut presents performance issues.

Exemple of the form of my data

This is what it looks like. I want to have an attribute telling the surface that is not under the pink layer for each grid cell (they already have an attribute telling the plain cell surface).

Edit : My aim here was to find the best solution for less computational ressources due to my large data.

2
  • Why didn't the Intersect work? If each grid had a unique ID, and you recalculate your area field after running it, you would have for each cell the area in pink and area not in pink. I'd use a pivot table at that point to get relative percentages and use that to select what grid polys to remove with a table join. However, you might want to look at the Overlap Analysis Tool as a simpler process. Commented Nov 19, 2024 at 15:20
  • 1
    Welcome to GIS SE. As a new user, please take the Tour. "It didn't work" isn't the most useful of problem statements. What were you expecting? What did it do instead? Please Edit the Question. Commented Nov 19, 2024 at 17:25

3 Answers 3

3
  1. Add a unique ID to your grid layer, e.g. using $id in the field calculator.
  2. Dissolve your pink coverage layer.
  3. Clip your grid layer (first GUI input) with the dissolved layer (second GUI input).
  4. Calculate the $area of the features in your clipped layer.
  5. Join attributes table the area after clipping to your original grid using the ID of your grid cells as attribute to join by.
  6. Use select by expression with (("clipped_area"/"original_area")>0.9) OR "clipped_area" IS NULL. The first part checks, whether your grid is covered by at least 90 % with the pinkish layer, the second part returns all grid cells with no joined area, because they're fully covered, hence no area is left after clipping. You need to replace the field names by those you used.
0
1

You can skip some steps from Erik's answer (step 2 to 5) if you use the tool "Overlap analysis". This works if all input layers are vector layers. Choose your grid as input and the cover layer as overlay. The result is a grid layer (spatially identical to your input) with the additional information on coverage (area & percentage) of your input by your overlay. Then you can filter, delete, ... features depending on your cut off value (check step 6 of Erik's answer).

EDIT: below screenshots of an intial grid and a filtered grid (coverage area > 50%)

Initial grid

Filtered grid with coverage greater than 50%

1
  • Strangely, the "Overlap Analysis" tool presented performances issues when tried, and i don't really know why. (by performance issues i want to say that it is way longer to execute than the "simple" clip from Erik's answer) Commented Dec 2, 2024 at 13:29
1

If your layers are not very large you can use an expression to select features from your Grid layer. If you have large layers, this will be slow.

area( intersection($geometry, collect_geometries( overlay_intersects( layer:='Forests', expression:=$geometry)))) / $area > 0.5 

overlay_intersects creates an array of all geometries in the Forests layer (change it to your layer name) intersecting each grid polygon.

collect geometries creates a multipolygon from all polygons in the array

intersection intersects the grid geometry with the multipolygon.

Then features with an overlap proportion of >0.5 ara selected.

enter image description here

1
  • 1
    I've tried expression based methods after, but as you said, it is very slow because of the scale of my data. Commented Dec 2, 2024 at 13:27

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.