I'm new to GIS. I want the sum of nighttime lights (DMSP) by district for some country. I'm running this arcpy.gp.ZonalStatisticsAsTable_sa(Limites_distritales, "IDDIST", rc, temp_table, "DATA", "") and then converting to .csv. However, when I check the output some districts (identified by IDDIST) are missing. I've checked all my script and they shouldn't be dropped; my guess is that they are being assigned NoData because they overlap multiple grids (and no single grid is in the polygon) and thus no statistics are being calculated for them.

One of the problematic districts is shown in the picture below.

Is there a workaround for this?

enter image description here


The Zonal Statistics as Table documentation states the following:

If the areas of single features are similar to or smaller than the area of single cells in the value raster, in the feature-to-raster conversion some of these zones may not be represented.

I suspect the algorithm assigns raster values to the zone if that zone contains the raster centroid. In your example, no raster cell centroids exist within the zone.


I had the same problem. spent a lot of time discussing it with ESRI support and the end resolution was that the code behind zonal stats looks for the center of the pixel to be contained by the polygon zone.

If the zone doesn't contain a pixel center (or if a pixel does not have its center inside a zone) - even if it overlaps with the area of the pixel, it's omitted from calculations.

My work around was to convert my raster data to polygons and then do a bunch of overlay analysis to get my totals. it takes way more time and memory, but I like that it takes partial coverage into account, which actually gave me correct averages for my coverages.

  • are you please able to give brief description of this "bunch of overlay analysis" workflow? – sparky Mar 6 '19 at 3:58
  • Well, the specific workflow would depend on your end goal, but overlay analysis in general includes operations like "intersect" "clip" "union". in teh OP's case, a union of the polygonized grid and the zones will produce a new set of polygons with borders from both inputs. The output will of course have a new area attribute but it also retains the input zones' original square footage number too. so for each input zone, you will get the area intersecting each grid and the area of the zone as a whole, with which you can calculate sums or percentages etc. – Zipper1365 Mar 6 '19 at 14:26
  • thanks. My end goal is to have zonal statistics for all of my polygons, right now missing about 100 out of 7295, but it will make it hard to analyze them equally when some don't have these statistics. The problem with unions and other overlay analysis for me is there are overlapping polygons, so those are lost in certain geoprocesses. – sparky Mar 7 '19 at 0:49

your zone for this analysis probably does not overlap any cell center from the value raster and hence is not counted as a valid zone. A workaround for this is to specify a smaller cell size in the ZonalStatisticsAsTable tool environment while running the tool. See the blog to learn more about it: https://www.esri.com/arcgis-blog/products/spatial-analyst/analytics/getting-the-most-out-of-zonal-statistics/ Hope that helps, thanks, Sarmistha

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.