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.

reef: bold black points

grid:white squres

enter image description here

Additional photo PHOTO: red is the reef enter image description here

The attributes of the reef layer

  • The reefs are all the bold black smudges? And you want the area they cover? Or do you need the area of all the grid-boxes overlaying reefs combined?
    – Erik
    Commented Oct 9, 2018 at 8:21
  • Thanks Erik. The reefs are the bold black points, And I want to estimate the area covered under each grid.
    – Gie
    Commented Oct 9, 2018 at 8:23
  • As in grid-box 1 covers 1acre of reef, grid-box 2 covers 5 acres, etc?
    – Erik
    Commented Oct 9, 2018 at 8:25
  • That's right, how much reefs are within the extent of each grid. ex: grid1: 25, 000 m2, grid: 3000 m2...and so on (in square meters or sq. km)
    – Gie
    Commented Oct 9, 2018 at 8:27
  • Are your reefs in point feature format? Are they graduated based on areal extent? If not, how is the data regarding the areal coverage of each 'reef point' incorporated into your project?
    – Maggie
    Commented Oct 9, 2018 at 8:36

3 Answers 3


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

enter image description here

enter image description here

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.

enter image description here

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.

enter image description here

Hope this resolves your problem. Good luck!


Probably long after the OP needs this, but here is an answer I think should be more straightforward than the existing ones. This uses QGIS 3.16.

  1. Dissolve the coral reef layer (Vector > Geoprocessing Tools > Dissolve)

  2. Run the Intersection tool (Vector > Geoprocessing Tools > Intersection)

    Input layer = dissolved coral reef layer from step 1

    Intersection layer = grid square layer

  3. Create an 'area' column in the attribute table of the Intersection layer. (See @Maggie's answer for steps to take).

  4. Run the 'Join attributes by location' tool (Vector > Data Management Tools > Join attributes by location).

    Base layer = grid square layer

    Joined layer = intersection layer from step 3

    To avoid duplicating columns, in the 'Fields to Add' box, click the button with three dots and select the just the 'area' column.

    Under the 'Join Type' drop down menu select 'Take attributes of the feature with the largest overlap only (one-to-one). (The dissolve step above will ensure there is only one polygon within each of the grid squares).


In QGIS 3.0.2 the tool I have used to solve this can be found here:

Toolbox > vector analysis > count points in polygon

enter image description here

Your 'polygon' should be the grid squares. Note there is a 'selected features only' tick box, if you wish to calculate for only specific polygons at a time.

Your 'points' should be your reefs.

'Weight field [optional]' should be the 'area' field (e.g. 2500m2 - this will obviously need to be an integer value) that is situated within the attribute table of your reef points data.

The output will be a replica of the input polygons (the grids), except the attribute table of your new 'replica' will contain a new field column which contains a SUM of all the 'weight field' data (your areas m2). This new column will be named by whatever you enter in the 'count field name' field (see image above). In this example case, this is 'NUMPOINTS'. This new field is your total reef area covered within the given polygon.

enter image description here

  • I'm sorry @Maggie, I checked the original file, the shapefile is not actually made of points but polygons
    – Gie
    Commented Oct 9, 2018 at 11:51
  • Could you please post a screenshot of an area zoomed in? So I can see the polygons within a grid square or two more clearly. Thanks
    – Maggie
    Commented Oct 9, 2018 at 12:00
  • Hi @Maggie, I dont know how to add here in the comment section so I added the image in the question field. Sorry :(
    – Gie
    Commented Oct 9, 2018 at 12:04
  • thank you so much and for being very helpful. But Im encountering several problems (1) If I use Intersect tool,my reef file has invalid geometries so the process cant proceed. (2) If I use the processing toolbox, the dissolved layer has only one row although I used the grid ID as the basis for dissolving the features. The reefs are dissolved as one layer instead of each grid.
    – Gie
    Commented Oct 12, 2018 at 1:42
  • You're welcome, apologies I haven't been more - as a next step I suggest checking your reef polygon layer for validity, prior to intersecting. vector geometry > check validity (QGIS 3.0). A quick google suggests to me that previous QGIS versions require a plugin for this function, see docs.qgis.org/2.14/en/docs/user_manual/plugins/…
    – Maggie
    Commented Oct 12, 2018 at 7:31

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.