I have a raster of morphology data where each bin has a code. I want to count the number of each code that fall under a polygon from another file. Zonal stats as table only gives me the min/max occuring codes and not count of each code. Can anyone suggest how to get count of each code for each polygon?


You can use the Tabulate Area tool to get the metrics you need for binned data. I often join the resulting table to the polygon boundary shapefile for convenience, although this is optional. Here is the workflow:

  1. Tabulate Area (Spatial Analyst). There are two inputs here: 1) the morphology raster and 2) a polygon shapefile of boundaries you would like to calculate area by class.
  2. Join Field (Data Management). This is optional, although it is useful to have the tabulate area table attributes joined to the boundaries polygon shapefile.
  3. Optional. Add new fields for each of the cover classes and calculate meaningful units. For example, if the projection is in UTM at 1m spatial resolution, the units in the attributes will also in m. Therefore, it would useful to calculate acres or hectares per boundary feature rather than the default m^2/feature.

Here is an example using a classified canopy cover raster dataset and a polygon grid shapefile.

The screenshot shows the results of the described workflow. I used a raster dataset with the following classes for this example: VALUE_1 = 0-1%, VALUE_2 = 1-5%, VALUE_3 = 5-10%, VALUE_4 = 10-20%, VALUE_5 = 20-30%, AND VALUE_6 = 30-40%.

enter image description here

enter image description here

  • I will try your solution and let you know. Thanks. – Hemant Mehta Mar 12 '14 at 19:07

I might advise you to try the QGIS 2.2 plug-in.


  • From the description, it seems to do what arcgis already does. I want the count by each code type and not just total count within the polygon! – Hemant Mehta Mar 12 '14 at 12:44
  • Thanks for your response. I did check out QGIS. Nice tool. – Hemant Mehta Mar 12 '14 at 19:07

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.