I have a raster about different land use types(5 types),each raster cell has a categorical value(1-5). ArcGIS Focal Statistics can calculate mean, range, and even variety of each processing cell, but I want to count the number of each land use type for the processing cell in the neighborhood area.

enter image description here

For example,the processing cell in pic has 3 land use type1, 2 type2, 2 type3, 1 type4 and 1 type5. (Neighborhood: 3*3 rectangle),how can I do this?


2 Answers 2


You can do it in two steps:

  1. calculate 10^(value-1) in the Raster calculator;
  2. then the Sum in Focal Statistics.

The output values will be between 0 (0 cells of any types in the neighbourhood area) and 90000 (9 cells of type 5 in the neighbourhood area) and their sum of the digits can be between 0 (no cell) and 9 (all the cells). For instance, the output of your illustrated example will be 11223, which stands for (reading from left to right) 1 cell of type 5, 1 of type 4, 2 of type 3, 2 of type 2 and finally 3 of type 1.

  • 1
    +1 It looks incredible but, it is true!
    – xunilk
    Mar 29, 2017 at 19:57
  • Thx,the method is useful!
    – Weber
    Mar 30, 2017 at 1:08

Reclassify the data so that all the values from 1 - 4 equal 0, reclassify the 5 values to 1. Run focal statistics using sum. The resulting raster will have the total number of 5 values within your roving window. Repeat four more times for the other values.


Your Answer

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

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