2

I have a raster file where the cells (1 meter) are classified as 1 (forest) and 0 (non-forest). I would like to create another raster (1 meter) where each cell is given the percentage of cells within 60 meters that are = 1 (forest).

I've looked at the Block Statistics and Focal Statistics tools but they do not quite give me what I'm looking for. The statistics are based on the values of the cells (1,0) not the count of cells in the search radius to calculate a percentage.

I'd like to keep this as a raster analysis rather than converting to points.

I'm using ArcGIS 10.5.1, Advanced.

3

You're right that those tools look at the cell values as opposed to a simple count. However, because you're using a binary raster, Focal Statistics is actually the appropriate tool for this.

Consider my own binary raster, particularly the cell in the middle:

random raster

If I count the forest (green) cells in the 3x3 neighborhood around it, I see that there are 3 of them. So the count is 3, divided by the total, 9, gives us a percentage of 33%.

Now consider: calculation of the mean is the sum of values divided by the number of values.

And also: counting in any program is simply increment by 1 for each feature, row, cell, &c, which matches your conditions. In a binary raster, counting and summing are identical.

If I run Focal Statistics on my raster and choose Mean for the output statistic, I'll get exactly what you're looking for. Here is the output of that raster, with the same center cell identified, and a value which matches what we calculated above by counting.

focal statistics output identified

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.