I have a vector polygon shapefile outlining counties for which I have a raster of nighttime-luminosity data. I've been able to compute Zonal Statistics in ArcGIS 10.0 using Zonal Statistics as Table and simply selecting the polygons as the first feature class option. However, I'd like to get some more stats than those that are available with the pre-packaged Zonal Stats. Specifically, I'd like to get counts and values -- for instance, the number of pixels with a given luminosity value in each polygon. Does anyone know if this is possible? If not in ArcGIS, in QGIS, perhaps? Thanks.

  • I believe you're out of luck. However, often there are workarounds available using existing functionality and they even can be efficient. If you could provide some more details about what you want to do, readers might be able to suggest solutions.
    – whuber
    Dec 19, 2013 at 19:24
  • 1
    So, I'd really like to get a count of how many 'lit' pixels there'd be in a given polygon, or pixels with positive values. Dec 19, 2013 at 19:48

2 Answers 2


there is another function called "zonal histogram" in ArcGIS (http://help.arcgis.com/en%20/arcgisdesktop/10.0/help/index.html#//009z000000w6000000.htm). With the table you can extract anything you want. It is however recommende to resample your nightime data before use in order to have an integer image.

Don't forget to set the pixel size equal to the resolution of your image when you use this tools because ArcGIS often uses a coarser resolution to reduce the computational cost.

  • if you need information to the right of the decimal in the image, you can multiply by some factor of 10 prior to applying int().
    – Roland
    Jan 17, 2014 at 17:00

For a count of "lit" pixels--or of any other kind of cell value for that matter--simply create a binary indicator grid. This is a grid with ones at the cells where the values are to be counted and zeros elsewhere: it should be clear that the zonal sum of these values counts the cells.

To create an indicator, exploit the fact that true values will be stored as ones and false values as zeros. If, for instance, a "lit" value is a positive value, simply compare the original grid to zero (using ">" in a raster calculator). There is no limit to the complexity of the logical criteria you can use in creating indicator grids; they can even be based on multiple grids. That makes this an extremely general and flexible technique for counting anything in a grid (or image) within (nonoverlapping) zones.

This question--and the answer--generalize the one at Finding zones with nodata in ArcGIS 9.3.

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.