English

How To: Remove and replace no data values within a raster using statistical information from the surrounding data values.

Summary

The instructions provided describe how to remove and replace no data values within a raster using statistical information from the surrounding data values. The following Raster Calculator expression uses a conditional statement and focal statistics to replace no data values within a raster with a value statistically derived from neighboring cell values. This is useful for removing gaps of no data from merged or mosaicked rasters, and for rasters that need to be exported for use in software that does not recognize assigned no data values.

Procedure

For versions 8.x and 9.x

1. In ArcMap, navigate to ArcToolbox > Spatial Analyst Tools > Map Algebra and open the Raster Calculator.

2. In Raster Calculator, input the following syntax:

Code:
CON(isnull([raster]), FOCALMEAN([raster], rectangle,5,5), [raster])


Note:
The size of the rectangle in the FOCALMEAN request can be edited to meet the needs of the data. Edit the "5,5" values to change the size of the rectangle. This may need to be smaller or larger, depending on the data.

3. Click Evaluate.

For version 10.0

1. In ArcMap, navigate to ArcToolbox > Spatial Analyst Tools > Map Algebra and open the Raster Calculator.

2. In Raster Calculator, input the following syntax:

Code:
Con(IsNull("raster"), FocalStatistics("raster", NbrRectangle(5,5, "CELL"), "MEAN"), "raster")


Note:
The size of the rectangle in the FocalStatistics request can be edited to meet the needs of the data. Edit the "5,5" variable to change the size of the rectangle. This may need to be smaller or larger, depending on the data.

3. Specify a location for the output raster.

4. Click OK.

Related Information