HOW TO

Determine percentage of a specified cell value within a defined neighborhood

Last Published: April 25, 2020

Summary

Steps for finding the percentage of a particular cell value within a defined focal neighborhood.

Procedure



  1. Create an intermediate grid with values of 1 where the input grid meets your desired condition, and 0 or NODATA everywhere else.

  2. Use the FOCALSUM function, with the DATA option on the intermediate grid, to determine the number of cells in the focal neighborhood that have a value of 1.

  3. Divide the sum by the number of cells in the focal neighborhood for the percentage.

    Code:
    PERCENTAGE_GRID = FOCALSUM( con( <input_grid> == <value>, 1 ), RECTANGLE, 3, 3, DATA) / 9


    Note:
    The above example nests the three steps into one expression, which determines the percentage of <value> within a 3 by 3 focal area containing 9 cells.

Article ID:000002535

Software:
  • Legacy Products
  • ArcMap 8 x

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic