Seems like such a simple plugin, but it just won't work.

I'm trying to run Zonal Statistics to find the mean value of a raster's pixels within the area of a vector polygon, but all it will give me is 'NULL'. The polygon and the raster are both in the same CRS. There is one null data point within the area, it has a no data value of -9 and is identified as "null (no data). But I don't believe that that is the issue because choosing an area that does not contain a null still doesn't work.

In order to see the new columns in the attribute table I find it necessary to toggle editing on the polygon on and off. I've tried running it with editing both on and off, one time it worked with editing on! But never again. Is it supposed to require editing to be on?

I'm using QGIS 1.8.0 on a Mac running OS 10.7.5.

The dashed line marks the bounds of "LowDustRegion". "Gale_Crater_1_tes_seasonal_Daytime_median" is the course resolution raster behind.

Only 'NULL' is recorder in the Attribute table.

  • 3
    I had the same problem, it was solved when I set both layers to the same CRS, please double-check that.
    – user23515
    Oct 31, 2013 at 19:34

5 Answers 5


I just had this problem and this may help: To guarantee the same projection for some reason it helps to just resave the polygon shapefile layer and set the projection there -- even if it already looks like it has the same projection.
right click layer > save as > give name > use "selected CRS" and find the same CRS as the raster > accept for save; use the new layer for the zonal statistics.

  • @underdark, I have the same problem but this solution did not solve it. I have buffer zones established around points and I'm looking to get statistics of the raster layer underneath. The values of the raster go from 0 to 5 (6 different classes) and I'm wondering it that's part of the issue. I'm looking to get information on how much of each classes (0 to 5) is found within each buffer.
    – Ninja Tuna
    Mar 8, 2016 at 14:25
  • Yes, this was the problem for me as well. thus I followed the steps to the letter and then the error is gone. Mar 2, 2021 at 5:47

I just ran into the same problem, and it seems that you can only get this to work if the name of your output field is 5 characters or less. I tried searching the forums to see if others had posted this info, but no luck so I figured it out based on trial and error (lots of error...). Incidentally, you do not have to be in editing mode to perform the zonal stats.

  • This worked for me too.
    – Simona
    Sep 17, 2015 at 11:57
  • Not necessary anymore (testet in QGIS 3.16 and newer)
    – Vincé
    Oct 29, 2021 at 10:00

This is an old post, but I recently ran into the same problem. It's not a very satisfying fix if you want to run a batch process, but I've found that if the QGIS geoalgorithms>Raster tools>zonal statistics plugin gives you null values, you can use the menu system to access raster>zonal statistics>zonal statistics. This calculated the zonal statistics for me without any null values.


I had the same problem (QGIS 2.18, MacOS Sierra). The standard QGIS zonal statistics would give NULL results when looking at it in QGIS. However, when exporting to a CSV file the NULL values turned into meaningful numbers. Not so useful if you want to continue working in QGIS but if you want to take it to a different program this might help you.


Make sure the raster layer entirely covers the input layer. If you clipped the raster there might be some edges of the input layer where the raster does not exist. This gives me a "NULL" value when I compute the zonal statistics.

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