I have a raster that has 5 classes and a polygon shapefile with 10 rows.

This is the raster: enter image description here

This is the shapefile with various shapes enter image description here

I want to get the pixel count

  1. by classes - 5
  2. by identity (there are 10 in the shapefile).
  • 1
    As long as the polygons are not overlapping then the Tabulate Area tool should do what you need.
    – Hornbydd
    Commented Aug 24, 2018 at 15:52

1 Answer 1


Tabulate Area will work for this. Shown below, is the result when I used the ROI feature class as the feature zone data, OBJECTID as the zone field, and Raster as the input raster. The result is a table that identifies the area per raster value per ROI area.

To determine the number of cells, you would need to divide the values in the Tabulate Area table by the area of the cells within your raster. For example, dividing 47.57 by 5.95 (the area of my raster cells) is 8, which is the number of raster cells with the value of 2 in the ROI where OBJECTID is 12.

enter image description here

  • How can the pixel count have many decimals? Commented Aug 24, 2018 at 19:49
  • Do the values sum up well? Commented Aug 24, 2018 at 19:49
  • These are areas, not cell counts. Divide by cell size to get them.
    – FelixIP
    Commented Aug 24, 2018 at 22:52
  • You are right @FelixIP. Thank you. I edited my answer to reflect this feedback.
    – reevesii
    Commented Aug 27, 2018 at 12:58

Your Answer

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

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