1

I'm struggling with a problem when working with a raster dataset of biotope types:

For each cell I would like to find out the frequency of classes in the adjacent cells, e.g. from the 8 neighbouring cells 3 are of biotope type A, 4 of type B and 1 cell of type C.

I was recommended to try out 'Block Statistics' and work with a moving window, but so without any success.

1
  • Welcome to GIS SE! As a new user be sure to take the tour. What precisely did you try in terms of 'Block Statistics'?
    – PolyGeo
    Jan 24, 2016 at 21:31

1 Answer 1

2

The result, however it happens to be stored or presented to you, evidently will be the equivalent of one raster for each class: a raster showing the counts of type "A", another showing the counts of type "B", and so on.

Compute these count grids by taking focal statistics of the indicator grids.

Recall that the indicator for any class is a grid having ones for cells where the class exists and zeros elsewhere. Create indicators by equating the original grid with the individual class values. The focal sum over a 3 x 3 annular neighborhood (that is, omitting the center) thereby counts the cells of that type. (If you don't want to compute a focal sum for annular neighborhoods--finding it perhaps easier to compute the full 3 x 3 focal sum--simply subtract each indicator from its 3 x 3 focal sum!)

You have to iterate this workflow over all class types.

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.