Count pixels located inside a polygon

9561
3
04-26-2011 03:31 AM
Highlighted
New Contributor
Dear colleagues,

I have superimposed a raster map, with different pixels values, and a shapefile (polygons). I would like to know if it is possible to find out how many pixel values of each class I have in each polygon.
I think I can accomplish it converting the raster map to a polygon map and applying an "intersect" but I would like to work directly with the raster map rather than convert it.
For instance, in the image I attach bellow, I would like to know how many green, orange, yellow and red pixels i have inside each polygon (black lines).

I would be really grateful if your could help me.

yours sincerely,

Guillem
Reply
0 Kudos
3 Replies
Highlighted
Regular Contributor III
Guillem,

Check out the Zonal Histogram tool.

This is probably a good starting point.
An overview of the zonal tools

Best Regards,
Eric
Reply
0 Kudos
Highlighted
New Contributor
Dear Eric,

Thank you very much for your help, I think it could be very useful, but I think Zonal histogram is only available with ArcGIS10 and I have the version 9.3.1.

On the other hand, I also need to know the number of pixels for each cluster with the same color.
For instance, in the image attached, I would need to know how many green pixels I have (this is easy), but the most difficult is to know how many yellow pixels I have in each yellow cluster.
The most problematic thing is that if you have a polygon feature, ArcGIS, only identify groups of pixels with the same value, in such a case color, and those which share some side each other, but not some vertex. In my case, the group of yellow pixels bold with a blue line should belong to the other group of yellow pixels located bellow but it is not because the two groups only share a vertex of one pixel instead of the whole side.

yours sincerely,

Guillem
Reply
0 Kudos
Highlighted
Regular Contributor III
Hi Guillem,

In ArcGIS 9.3.1 you can do a zonal histogram from the spatial analyst toolbar.  See About zonal histograms in the 9.3.1 documentation for steps and screenshots to help you along.

To answer the question of, "How many yellow pixels I have in each yellow cluster", you can run Region Group.  Region Group records the identity of the connected region to which that cell belongs. A unique number is assigned to each region along with a count of the cells that were connected.

Regards,
Eric
Reply
0 Kudos