I would like to know how to calculate the area of the vector layer (red in the photo) under each polygon (white square in the photo). The red layer has the area (km2) in its attributes. But what I want to know is how much (area) of the pink layer is within the square grid. Both my layers are in meters already.
-
Welcome to GIS SE, next time, instead of creating a new question, you could simply edit the original one so it is more succint and reflects newly found information.– GabrielCommented Oct 9, 2018 at 12:49
-
Im Sorry @Gabriel C. I will take note of that. I already messed up the 1st one so I thought of creating another question.– GieCommented Oct 9, 2018 at 12:53
1 Answer
The easiest may be to calculate each area in the red vector, then and join data to your polygon layer.
Fist use "Clip" tool to clip your red vector layer with your polygon layer. Then compute areas in a new field with "Field Calculator" and $area
expression. Finally use "Join attributes by location" to join your clipped layer data to polygons.
About "Join by location" settings, be careful with spatial criteria choice, within
should be ok. And if some of you polygons contains more than one feature you may have to use sum
value in Statistical summary parameter.
-
thanks @MaxPlank. What do you mean by "some of the polygons contains more than one feature"? I encountered last time that I tried Intersect before and I got many areas under one id #. meaning the same ID, different rows and different areas calculated.– GieCommented Oct 9, 2018 at 12:52
-
If you use intersect, a polygon in your red layer that will have a common boundary with your square grid polygons will get included. If using Within, those will get ignored. You might still get more than one polygon inside the grid cell so you need to sum their areas to get the total area within the cell.– GabrielCommented Oct 9, 2018 at 15:24