I have imported to QGIS two files, one .tiff that contains the coverage data in a given area and a shapefile that contains the division of the area (e.g., states). I want to get statistics using both, like for example, I want to know the percentage that each subarea is covered.

enter image description here

  • 1
    Please see the screenshot. I have tried merging them together but I get an error message saying that in order to merge both files have to be vector files. I have also tried converting to vector the raster but that won't work either because the raster doesn't have the areas IDs.
    – Estefy
    Jul 14, 2020 at 19:16

1 Answer 1


There are a number of tools in the processing toolbox that may do what you want. If your coverage tiff is a simple binary raster then the Zonal Statistics tool will give you the the sum or count of the pixels from there you would add an attribute field to calculate the percentage of the pixel area vs the total state area.
If it is a classified layer such as different kinds of land cover then Zonal Histogram will give you the count of each landcover in that state then you would have to create some new attribute fields to calculate the percentage.

  • Thanks. That was super helpful. However, when using Zonal Statistics to calculate the count and the sum (in order to get the percentage of area covered) , I get the same value for count and sum. Any idea why this might happen? Thanks again
    – Estefy
    Jul 14, 2020 at 19:45
  • 1
    If your raster has only 1's (the pink area) and not data (the white area) then they will be the same. Although I am confused because according to your layer legend you should have 0,1,2,3. You will need to figure out the area of each pixel and then multiply the count or the sum by that and then compare it to the area of the state.
    – Baswein
    Jul 14, 2020 at 20:02

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.