For my master thesis I want to calculate the mean percentage of sealed surface in some parks of Berlin.

For this purpose I have a rasterlayer containing this data. In a previous step I already created the polygon shapefiles of the parks.

For the calculation of the mean value I used the Zonal Statistics Tool in Qgis. After checking the results though, it became clear to me that something must have gone wrong. Even small park with very little sealed surface showed up with values of 70 %.

I'm pretty sure the reason for this is that somehow the rasterlayer does not correctly show 0 value pixels. Since only pixels different from 0 was used for the calculation, which could also be seen in the "count" value. I added a screenshot to make this point clear. In the picture you can see that the tool only was calculating with the 8 values of the pixels with values bigger than 0 and completely neglecting the big area with 0 value, resulting in a mean value of 72.25 % which is much higher than the true value.

enter image description here

One step I took to solve this problem was to remove the tick for the "no data value: 0" in the properties section of the raster. In the metadata it still shows "no data value" as 0, though and the results of the calculations did not change. According to the colleague from whom I got the layer, it should contain 0 values, though.

up vote 1 down vote accepted

I finally found a solution by using the "Reclassify values" algorithm of the SAGA package in the toolbox as described already in this post here: Redefining nodata value into zero in QGIS?

As a quick comparison I added a screenshot with the results of the Zonal Statistics tool after replacing no data with 0. The No Data value then got changed to -99999 in the meta data of the reclassified grid.

enter image description here

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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