# Count the number of raster tiles in each polygon in ArcGIS

I have a raster from the TRMM 3B43 product that contains a grid of 0.25 x 0.25 tiles (in degrees). I also have a shapefile with a number of districts. I want to know how many raster tiles are included in each district (polygon). Ideally, I'd like to know it as a continuous measure (i.e. polygon A contains 2.43 tiles) but if it only counts complete tiles its also OK. ## 2 Answers

While reclassifying as mentioned above is one method, another is the Tabulate Area Tool.

This will allow you to tabulate the area of individual pixels based upon the polygons you wish to examine, and will also tell you the number of pixels per polygon. It is commonly used for automating an error matrix (with some additional minor calculations required).

• +1 for a better alternative – yanes Dec 3 '15 at 17:03
• -1 It is not a better alternative because raster is continuous surface - precipitation grid. Tool will not work on a floating point raster or will produce countless number of fields if raster converted to integer – FelixIP Dec 4 '15 at 2:06
• I meant the choice of the function 'tabulate area', the first step of changing the raster into a binary is still needed. yeah..It is not a complete answer though.. – yanes Dec 4 '15 at 3:28
• Thanks Corey, yanes and @FelixP, will indeed try out these methods and see what results. Indeed, I was looking for a continuous measure (e.g. 2.54 tiles in certain polygon) so your suggestions below seem appropriate. – Francisco Dec 4 '15 at 16:01
• No problem @Francisco I've recently worked out a similar problem using non-contiguous polygons and a DSM and had this pointed out to me by a colleague. – Corey Pembleton Dec 4 '15 at 16:12
1. Convert your raster into a binary value of 0 for no data and 1 for data `Con(IsNull(Raster1),0,1)`

2. Use either `Zonal Statistics (spatial Analyst) or Zonal Statistics as Table (spatial Analyst)` functions to calculate the number of grids within each of your polygons. Parametrize the function using SUM so that the zonal summary counts all the cells and sums the cells within the polygons. Since all cells with data are coded as 1 the sum will give you the number of cells per polygon. However, for smaller polygons you will still have 1 for each of the polygons, even if the same raster cell covers multiple small polygons. This will inflate the number of cells if you use the statistics from the zonal summary.

• Convert binary raster Con(IsNull("RASTER1"),1) to polygon. Intersect it with districts. Summarise areas by district ID and divide by area of cell. Result with decimal points accuracy – FelixIP Dec 4 '15 at 2:08
• I wasn't sure if OP wanted # of cells or area. Of course Area is probably the needed end result, but wasn't specified in the question. It is possible # of cells is OP's end game, if for example it was needed to create a categorical index of areas that have more or less of a certain # of cells. – yanes Dec 4 '15 at 2:45
• area / cell_area = number_of_cells – FelixIP Dec 4 '15 at 2:46
• Second thought yes, its a much better option complete with the faction value. – yanes Dec 4 '15 at 2:49