Thursday, December 26, 2013

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

Article ID:21261
Software: ArcGIS - ArcEditor 8.1, 8.1.2, 8.2, 8.3, 9.0, 9.1, 9.2, 9.3, 9.3.1, 10 ArcGIS - ArcInfo 8.1, 8.1.2, 8.2, 8.3, 9.1, 9.2, 9.3, 9.3.1, 10 ArcGIS - ArcView 8.1, 8.1.2, 8.2, 8.3, 9.0, 9.1, 9.2, 9.3, 9.3.1, 10
Platforms: Windows NT 4.0, 2000, XP, 2003Server, Vista, 2008Server, Win 7

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:


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


 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:

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

 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.
 

No comments:

Post a Comment