This question already has an answer here:

I am using the plugin zonal statistics to calculate the sum of the raster cells within polygons. How does this plugin handle pixels that are on the border of the polygon, are those cell values included in the statistics?

I am using QGIS 1.8.0.

marked as duplicate by PolyGeo Jul 27 '18 at 1:32

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    This is a question you can answer authoritatively by yourself, simply by specifying a cell size so large that one or more of your polygons consists entirely of border cells and then running the procedure. – whuber Feb 17 '13 at 22:05
  • They are excluded by default in most software – If you do not know- just GIS Jun 22 '14 at 2:42
  • @whuber I tried this, but with "count" instead of "mean", and I got a value of 0.45 for a raster whose cell size is approximately the same size as the polygon. So Zonal Statistics clearly samples partially-overlapped pixels, but it's not clear how they're used/weighted. One would assume simple area weighting, but this question makes me wonder...gis.stackexchange.com/questions/254974/… I think this question deserves a formal answer in the QGIS documentation but I can't seem to find one. – Jon Mar 22 '18 at 15:38
  • 1
    @Jon Most zonal stats procedures do not resample: they determine whether a cell belongs to a polygon based solely on the position of the cell's center relative to the polygon. However, depending on how you invoke zonal stats and your environment settings, the software might first project, resample, and/or align cells, resulting in resampling anyway. Thus, if you wish to study this further, make sure you have suppressed all such intermediate operations. – whuber Mar 22 '18 at 15:43
  • @whuber Ok, but if a non-integer count is returned, as is the case with QGIS's Zonal Stats, it's not simply a matter of inclusion/exclusion of each pixel. All my tests were performed with data in the same unprojected WGS84. – Jon Mar 22 '18 at 15:46