


I created 100 identical circular polygons, each with a radius of 2,000 meters. I randomly distributed them across the landscape, then I ran a "ZonalStatsTable" request to get polygon statistics based on an underlying grid. All the circles were made exactly the same way, and appear identical except for location. They all have the same number of vertices and the same polygonal area. The grid cell size was 92.662394 meters and the polygon areas were 12,565,732.6848 sq. meters. (12,565,732.6848) / (92.662394squared) = 1,463.46 Therefore I expected each polygon to have close to 1,463 cells. Naturally this number should vary some because the polygon locations were random. For the most part, this expectation was accurate. 81 of the 100 circular polygons contained between 14601468 cells. The remaining 19 polygons, however, ranged between 15061518 cells, with no polygons containing cell counts between 1468 and 1506. I suspected that the cell counts of those polygons containing 15061518 cells were not accurate, so I took the circular polygon with the highest number of cells (1518) and actually counted all the cells whose cell centers lay within the polygon boundary. This polygon is pictured below. I used the "CellTools" sample extension to draw a grid representing the cell boundaries, then broke that grid up into 100cell blocks to make it easier to count.
A cell in considered "inside" the polygon if the cell center is contained within the polygon boundary. According to my count, this polygon only contains about 1,467 cells. According to the ZonalStatsTable request, this polygon contains 1,518 cells. Therefore, it appears that in some cases the "ZonalStatsTable" request is using more cells than it should in the analysis, and thus the statistics may not reflect the true set of cells enclosed by the polygon. Alternative Modified Version of ZonalStatsTable: This extension offers a modified version of the "ZonalStatsTable" request that appears to produce more reliable results. Conceptually, this modified process can be pictured as taking each polygon separately, using it like a cookie cutter to clip out only those grid cells that lie within the polygon, then running 'ZonalStatsTable' on only that polygon and only those clipped grid cells. Technically, the modified version takes each polygon in the theme and converts it into a grid with the same cell size as the Input Grid, producing a grid of "1" values in the shape of the polygon. It then multiplies that grid by the Input Grid, thereby converting all cells outside of the polygon into "No Data" cells while retaining the original cell values inside the polygon. Finally, this extension uses the 'ZonalStatsTable' request on the modified input grid to generate statistics for that single polygon. This process eliminates the possibility that the 'ZonalStatsTable' request will select cells outside of the polygon boundary by converting all cells outside of the polygon boundary into "No Data" values.
Enjoy! Please contact the author if you have problems or find bugs. Jeff Jenness jeffj@jennessent.com
3020 N. Schevene Blvd.
Flagstaff, AZ 86004 USA More Online Documentation for " Surface Areas and Ratios from Elevation Grid" extension....
Please visit Jenness Enterprises ArcView Extensions site for more ArcView Extensions and other software by the author. We also offer customized ArcViewbased GIS consultation services to help you meet your specific data analysis and application development needs. 