1

I'm having trouble with using QGIS.

I have a GRIB file containing meteorological data, this is loaded in QGIS as raster data if I'm not mistaken.

I also have a shapefile containing a polygon, describing regions within the area covered in the GRIB file.

What I need to know, is how many % of a raster-cell is covered by a region within the polygon. I'm using QGIS.

What I have done so far, is I rasterized the polygon, and used zonal statistics to calculate the SUM and COUNT on the shapefile, and then used the field calculator to calculate the percentage covered. This does not seem to provide the result I hoped for.

Can anyone push me in the right direction?

1 Answer 1

1

Zonal statistics is indeed the right plugin for you. You want to compute a 'Mean' statistics. Create a column in your shapefile with all values set at 1. Then run the zonal statistics, the output column being the mean of the newly created column.

That's it: the resulting column in your raster should now range from 0 to 1, which represents the ratio of the raster cell intersected by your shapefile.

2
  • Do I still need to rasterize my shapefile after adding the column? When I do rasterize the shapefile, and calculate the mean, I get 1.00000 for every polygon in the shapefile. This is not what I hoped for. Am I still doing something wrong?
    – Rik van den Heuvel
    Oct 5, 2016 at 7:42
  • Sorry to bump this question again. But this was not the answer to my question. You have posted another solution which was 100% perfect, but then my question got moved from stackoverflow to here and the original question got deleted. Now that answer is nowhere to be found but i need it desperately. Do you perhaps know what the solution to the problem was? Thanks in advance! Apr 6, 2017 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.