I want to estimate the area of the reef under a polygon grid.
My shapefiles are already in meters, however I am having a hard time calculating the area under the grid layer. Attached are the photos.
I want to calculate the total area of the bold black polygons (reefs) under each grid square (image 2). How much reef is inside each square, for example, grid1: 25 sq.km, grid 1 sq.km, etc. Each reef polygon has its corresponding area in the layer attribute table.
Additional photo PHOTO: red is the reef
The attributes of the reef layer
Best Answer
Note this solution relies on QGIS calculating the polygon area, rather than utilising the area data contained within the attribute table already. If this would cause accuracy issues, you will require an alternative solution!
1) Processing toolbox > vector overlay > intersection
input layer = coral reef vector
intersection layer = grid square layer
2) vector geometry > dissolve
input layer = intersected layer from step 1.
Unique ID fields = the 'ID' field from your grid vector layer (which should now be one of the fields in your new 'intersection' output layer. This step faciliates an association between all polygons that fall within a given grid square ID.
3) Open the attribute table of your new 'dissolved' output layer, created by step 2.
Open 'Field calculator' > in the 'expression' builder, enter '$area' (without the inverted commas)
Tick box 'Create a new field'; enter a name for your new field column in 'output field name' ('Reef_area'?). Make sure to uncheck 'Only update selected features'. Execute.
Hope this resolves your problem. Good luck!