How would I fix my DEM because it has holes?

I need to maybe extrapolate from surrounding terrain.

Here is the picture

enter image description here

  • Belated welcome to GIS SE! As a new user be sure to take the Tour to learn about our focussed Q&A format. I recommend not thinking about GIS SE as being some sort of online GIS tutor. For your questions to be answered here they should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. – PolyGeo Oct 6 '17 at 0:19
  • I would look into filling the data gaps with a global elevation dataset such as SRTM. – Aaron Feb 26 '20 at 12:54

There is a elevation void raster function in arcmap. This function uses the Plane Fitting/IDW void fill method. First a basic method is used, where the average of the eight neighboring values are calculated to fill small voids, then the plane fitting method is applied. If the error of the plane fitting method is too large, an inverse distance weighted (IDW) algorithm is applied.



It's a raster function and needs to be applied as part of a function chain. (C/O Luke)

  • 1
    No, the Elevation Void Fill function isn't a tool and can't be run like other geoprocessing tools. It's a raster function and needs to be applied as part of a function chain. I recommend you expand your answer to mention this. Imaginary bonus points :) for some details on how to apply the function to a raster! – user2856 Sep 21 '17 at 5:32

The first answer on this GeoNet post makes sense to me. It reads:

I use the following method to fill gaps in DEM. I uses a moving window that searches the DEM for Null data values and fills them with an average of the surrounding pixels.

new_DEM_name = con(isnull(old_DEM_name), focalmean(old_DEM_name, rectangle,4,4), old_DEM_name)

change "new_DEM_name" to anything that you want. "old_DEM_name" is the name of your DEM that has gaps in the data. You can adjust the size of the window by change 4,4 to 6,6 or anything you want.

answer credits : jmeisel

  • The problem of your solution for the particular case represented by the picture attached to the question is that it calculates the mean on a rectangle which takes into account also the banks which look very steep. By doing so, you won't ever have a good solution. I am playing around with the void fill function to find the bast solution since I have a similar problem. – brodegon Feb 26 '20 at 11:28

The previous answer could be applied also using the raster calculator, by writing something like:

Con(IsNull("your_raster_with_voids"), FocalStatistics("your_raster_with_voids", NbrRectangle(4,4,"CELL"), "MEAN"),"your_raster_with_voids")

You could change NbrRectangle and MEAN to find different solutions. I tried to use NbrCircle and MINIMUM instead, but I never got satisfying results.


Usually, voids in a DEM come from a water body. If not, try to find another DEM to find missing values.

so the best way to fill it is to use the minimum value of the observed height values, because with the mean value you would have water level above the elevation of some banks. There are several ways to do it, here is an easy way step by step. Special care is needed if there is a dam that is not visible at the resolution of your DEM. In this case, you should rather define the elevation manually.

1) identify pixels with no values and assign them a value of 1

holes = Con(isnull("mydem"), 1, 0)

2) create a buffer around the patches of 1 to get all the pixels around each "hole"

holes_buf = Expand(holes)

3) assign an unique value to each patch

groups = RegionGroup("holes_buf")

4) run the zonal statistics for each patch

zonStat = ZonalStatistics (groups, "VALUE", "mydem", "MINIMUM")

5) replace hole values by zonal stat values. Additionnal contraint could be added based on the "group" values in order to avoid filling the "true" NoData outside of the area were the DEM has been produced.

Con(isnull("mydem"), "zonStat", "mydem")

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.