HOW TO

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

Last Published: January 27, 2022

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.

Note:
This article applies to retired ArcGIS versions 8.x, 9.x and 10.0. Later versions of ArcGIS may contain different functionality, as well as different names and locations for menus, commands and geoprocessing tools.

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:
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.
  1. 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:
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.
  1. Specify a location for the output raster.
  2. Click OK.

Article ID:000004792

Software:
  • ArcMap

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic