I have raster data of a continuous field. I need to calculate zonal statistics on that data for some polygons (e.g polygons A and B in the image).

It is essential that I have as complete as complete a raster coverage for each polygon as possible but around polygon boundaries I have missing data which I would like to interpolate.

The nature of the data means I cannot reasonably interpolate more than 1 cell from a known value. So for polygon A where data has not been collected I want the raster cells to remain NoData (unless it is within a single-cells distance of a sampled cell).

Is there a raster analysis 'spread' function or similar that will interpolate only cells like the ones in green in the second image i.e. interpolate values only for cells that are adjacent to those that have a value?

Limited interpolation of raster data

1 Answer 1


You could try the FocalStatistics tool from ArcPy.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace= "C:/yourfolder"
arcpy.CheckOutExtension ("Spatial")
outCon=Con(IsNull(inRaster), FocalStatistics (inRaster, NbrRectangle (5,5, "CELL"), "MEAN"), inRaster)

Maybe you have to change the (5,5, "CELL")-values to change the Size of your "moving" Rectangle.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.