8

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.

ZKB
  • 1,154
  • 11
  • 12

2 Answers2

9

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

Baswein
  • 2,294
  • 13
  • 21
3

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

WhiteboxDev
  • 11,025
  • 1
  • 35
  • 65
  • 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
  • Well that is really quite odd. I just released a new version of WhiteboxTools yesterday. Hopefully there isn't anything wrong with it. Are you able to forward me your GeoTiff via email? – WhiteboxDev Aug 23 '18 at 14:16
  • I just used the FillMissingData tool on both the QGIS plugin and the wb_runner script and both worked fine with my sample GeoTiff file. I wonder what is different about yours. How was it generated? – WhiteboxDev Aug 23 '18 at 14:17
  • After saving my DEM to a now file, the algorithm doesn't crashes any more. But instead of interpolating the holes interior according to the holes border values, it just replaces nodata values by 0. – ZKB Aug 23 '18 at 14:39
  • where do I send you the dem ? – ZKB Aug 23 '18 at 14:42
  • Just send it to the contact for John Lindsay on the WhiteboxTools website (email provided there, but I am reluctant to post it to this site). Hopefully we can rectify things for you. – WhiteboxDev Aug 23 '18 at 15:23