6

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

4 Answers 4

5

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.

4

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.

4
  • are you please able to give brief description of this "bunch of overlay analysis" workflow?
    – sparky
    Mar 6, 2019 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, 2019 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, 2019 at 0:49
  • How could you discuss with ESRI support. I have a problem that seems a bug!! the very same thing used to work perfect before I upgraded to the latest ArcGIS pro 2.8.2. This is a link to my detailed question ( tinyurl.com/538pct9h)
    – BobbyF
    Aug 30, 2021 at 18:05
0

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

0

I was having this issue with the Zonal Stats 2 tool (Spatial Analyst Supplemental Tools). I tried everything I could find including reducing the raster cell size down to 1 meter (which theoretically makes more pixel centers in each polygon), but every time I ran the tool it would only process 1,146 out of 6,750 polygons. My solution was to divide the polygons into small batches, and it worked perfectly. I was able to process 400 polygons at a time (I didn't try more than this).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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