4

I have a layer that represents the green areas of a city and another layer that is a 36x24 mesh surface, where each square is 200x200 meters. Next, I made an intersection (orange on the 1st image) between the two layers so that it produces the green areas divided within each 200x200 meter polygon.

Here I want to apply a command similar to ''Count point in polygon'' but, instead of points, with areas of the polygons inside the squares. I have so far I haven't found a plugin or function that does that. I want to do something like the 2nd image.

Is there a way to do a function similar to ''count points in polygon qgis'' but instead of points, with areas within each square?

enter image description here

enter image description here

enter image description here

1 Answer 1

4

Use this expression:

array_length(   
    overlay_intersects( 
        'green_areas',  -- change this to match the name of your layer
        $id
    )
)

Use this expression with Field calculator to create a new attribute or wherever you need it, e.g. as a label as in the screenshot here:

enter image description here

3
  • It has gone well. But what I want to try to do is that each square is classified according to how much surface of the layer it has. For example, in the image it is seen that the plot (red) occupies more area than the other (blue), and on the other hand it seems that the latter has a higher number. I would like to make the numbers indicate the amount of surface (orange) that it contains, for example, in m².
    – Xenmas
    May 2, 2022 at 15:02
  • To do this, see here: gis.stackexchange.com/a/397101/88814
    – Babel
    May 2, 2022 at 15:35
  • Okay, thank you very much!!!
    – Xenmas
    May 3, 2022 at 8:09

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.