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?

migrated from stackoverflow.com Oct 25 '16 at 18:59

This question came from our site for professional and enthusiast programmers.

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.

  • 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 '16 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! – Rik van den Heuvel Apr 6 '17 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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