Select to view content in your preferred language

Zonal Histogram

3962
5
02-21-2014 11:08 PM
SainglongKaing
Emerging Contributor
I have some problems using "Zonal Histogram" tool to find how many pixel values fail within each polygons (blue circles as shown in the figure). All polygons are a buffer of same distance, thus the area of the polygons would contain same pixels. So far, my problem is that the sum of pixels I got are not the same which should not be true. Could anyone tell me why? If I'm wrong, what can I use to summarize the number of pixels in this polygon?

[ATTACH=CONFIG]31679[/ATTACH]
5 Replies
XanderBakker
Esri Esteemed Contributor
If you look at the help topic on "Zonal Statistics (Spatial Analyst)", you will find the following text:

If the zone input is a feature dataset, a vector-to-raster conversion will be internally applied to it. To ensure that the results of the conversion will align properly with the value raster, it is recommended that you check that the extent and snap raster are set appropriately in the environment settings and the raster settings.

It is possible that when you manually convert the blue circles to raster (using the existing raster as snap raster), that the number of pixels per circle may be slightly different due to their relative position to the pixels of the other raster.

Kind regards,

Xander
0 Kudos
SainglongKaing
Emerging Contributor
Dear Xander,

I've read the help of zonal histogram and it recommends to convert features to raster before performing zonal histogram unless feature-to-raster conversion will be internally applied. As the result, both cases gave me the same result.

For what I have checked, the sum of pixels within the features is not the same is because some feature are intersected and the first feature of OBJECTID order will select the pixel surrounding. Finally, the next feature will select only those are not overlaid. That's why this makes difference.
[ATTACH=CONFIG]31720[/ATTACH]

Thanks for sharing!

Jollong
0 Kudos
XanderBakker
Esri Esteemed Contributor
Hi Jollong,

In that case you should divide your zones featureclass into multiple featureclass without any overlap and perform the zonal statistics for each featureclass. The alternative is to convert your raster to polygons and perform an intersect with your circles. If I'm correct the overlapping circles will not be a problem in the vector analysis.

Kind regards,

Xander
0 Kudos
SainglongKaing
Emerging Contributor
Xander,

I was also thinking about separating the overlaid features but I have more than 300 features. Thus, it's gonna be very tough. Also, your alternative way is also possible. If so, I'm not sure whether I can find how many percentage of different features (converted pixels) in each circle.

With regards,

Jollong
0 Kudos
XanderBakker
Esri Esteemed Contributor
Hi Jollong,

In case of going for an intersect, you should start with converting the raster to polygons. Make sure that the "Simplify polygons" option is switched off. Intersect this polygon featureclass with your zones (circles). The resulting polygon featureclass will have areas containing information for each (part of a) pixel within each zone (circle). Since you know the area of the circles you can calculate for each feature (combination of zone and pixel) the fraction of the circle area. If the area of the circle varies, you can join it from the zones to the intersect result.

See the image below:

[ATTACH=CONFIG]31721[/ATTACH]

The ZoneArea is obtained by joining the original area of the zones and the percentage is calculated by dividing the Shape_Area by the ZoneArea (* 100).

Please note that some combinations of zones and pixels occur twice in the table. These is caused by the overlap between the zones (circles). You should aggregate the results to obtain a more useful result.

Kind regards,

Xander
0 Kudos