Hexagon Geospatial

Spatial Recipes

The IMAGINE Spatial Modeler provides the user with hundreds of functions, algorithms and analytical routines that can easily be chained together into models that solve Geospatial problems.
Showing results for 
Search instead for 
Do you mean 


Download model and sample data




I received a request to produce a model that would interpolate values to fill in holes present in a digital elevation model (DEM). Such holes can be common in DEMs derived from Interferometric SAR techniques and LiDAR data.


Input DEM with holes shown in red Output DEM with continuos surface
before.png fter.png


As an example of the versatility of using Spatial Models, I used this older model as the starting point for building up this model, because it already showed how to turn individual pixels into point features attributed with the corresponding pixel's DN value:






The premise of the model is that there are patches of the DEM where no data could be generated and so there are "holes" (which were already set to value-based NoData in the DEMs I used to test the model). It was desired to fill these holes by using valid height values from around the edges of the holes to interpolate a continuous surface across the gaps. So the holes are turned into a unique class value (32767 was used in this model) and then that class is buffered (using the Search operator) to a distance of two pixels to form a two-pixel wide band (or ring) around each hole. Two pixels is used as the default, but the user can specify a larger (or smaller) distance if desired.


Create Unique DN Values sub-model


All pixels falling under the buffer band are then converted to point geometry features and attributed with the height value of the underlying source pixel. 


These height point features are then used as input to the Convert to Surface operator which will create an interpolated continuous surface. 


Just the original hole locations are then filled in using the interpolated values so that the original DEM values are not altered. 

Finally, if present in the input DEM, the vertical datum information is reattached to the raster stream and a new raster DEM is output.




  1. Single band raster DEM as input
  2. Any gaps in the raster must be pre-defined as NoData (before being input to the model)
  3. Ideally the DEM should have a vertical datum defined, but it's not necessary
  4. If you have more holes than pixels, you may be better off using Terrain Prep Tool instead
  5. As implemented, the number of pixels in the input DEM must be less than can be contained in a u32 integer (see Create Unique DN Values sub-model above), i.e. 4 billion pixels, or the equivalent of a 64k x 64k image.


Input parameters:


Raster DEM: Provide the input image filename of the raster DEM with NoData holes.

Output DEM: Provide an output DEM name with NoData holes closed

Hole Buffer: Distance (in pixels) around the NoData holes to buffer. These pixels provide the height samples for the interpolation, Default is a 2 pixel wide ring.




Example data


s17.dt1 – a Digital Terrain Elevation Data (DTED) raster file derived from the Shuttle Radar Topography Mission (SRTM) with occluded pixels marked as NoData