I have a DEM raster where all the buildings have been extruded and now contain "nodata" values. I'd like fill the holes and get a nice and continuous surface (which would approximately correspond to the natural terrain). I tried the Fill Nodata function in QGIS (Rater -> Analysis -> Fill Nodata) without changing the parameters. The holes are filled but strange lines appear (probably due to the near topography characteristics).

enter image description here enter image description here

Is there another way to fill the missing values by getting a smooth and continuous ground and without changing the rest of the DEM? I tried to use the r.fillnulls function (GRASS) but it always crashes for an unknown reason.

  • You could try the Saga Close Gaps function. – Baswein Aug 23 '18 at 3:08
  • I don't get realistic results when I interpolate with a spline function. – ZKB Aug 23 '18 at 13:55

I got curious and tried the different fill nodata functions. As you can see the regular SAGA Close Gaps produced the least anomalies. It also took the longest.
DEM with nodata gaps

GDAL Fill nodata SAGA Close Gaps

SAGA Close Gaps Spline SAGA Close Gaps Stepwise Resampling


You can try the FillMissingData tool in the WhiteboxTools plugin as an alternative method. I have had good performance with this tool for spanning the gap of NoData produced when removing buildings during LiDAR interpolation. The plugin requires the WhiteboxTools library, found here. I should note that the plugin requires QGIS 3.0 or higher.

enter image description here

enter image description here

  • I can't install the plugin. I use latest version of QGIS (3.2.2-Bonn). When I install from ZIP the plugin I get the following message : "The plugin is broken Missing metadata". – ZKB Aug 23 '18 at 13:26
  • So I installed WBT from source from Git repository. In parallel, I installed the plugin developed by Bruy which I could install without issue. In the WBT processing toolbox settings I indicated the path to the executable (finishing with "whitebox-geospatial-analysis-tools-master/whitebox_tools/target/release/whitebox_tools.exe). But when I run a processing tool I always get the next error message:" "Reading data... thread 'main' panicked at 'The TIFF file does not contain geokeys', src\main.rs:75:21 note: Run with RUST_BACKTRACE=1 for a backtrace." – ZKB Aug 23 '18 at 13:26
  • Hmmm, that's curious. I must admit that I don't tend to run WBT from the QGIS plugin, but rather using the wb_runner.py script. WBT doesn't use GDAL for decoding/encoding GeoTIFF files but rather uses it's own implementation. It isn't as robust and doesn't support all kinds of TIFFs, including certain types of compressed files. Is it possible that your file is compressed? – WhiteboxDev Aug 23 '18 at 13:35
  • I forgot to say that I Rust compiled the "WhiteboxTools" contained in "Whitebox Geospatial Analysis Tools" sub-directory, which contains a "Cargo.toml" file. Indeed, the "whitebox_tools" folder in "Whitebox Geospatial Analysis Tools" only contains a "README.md" file. Then I replaced the old "WhiteboxTools" folder with the one recently compiled in "Whitebox Geospatial Analysis Tools". – ZKB Aug 23 '18 at 13:37
  • My DEM files is not compressed (nor any files that I loaded in my project). I have the same error message when I run the wb_runner.py script. – ZKB Aug 23 '18 at 13:39

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.