1

I have a DEM from a terrassed olive grove (single trees apart from each other) and would like to get clean contour lines (without trees / bushes) from it using QGIS3.

Cleaning up all the contour lines manually seems daunting, so I hope there is a more automated process within QGIS3 or even before extracting contour lines...

What would be a sensible workflow starting with the DEM? Or do I need another software like Blender to "erase" the trees before extracting the contour lines in QGIS?

after contour line extraction in QGIS3

DEM

Kadir Şahbaz
  • 76,800
  • 56
  • 247
  • 389
Chris
  • 11
  • 2
  • 3
    Did you create the DSM yourself from lidar data? – BERA Nov 18 '20 at 18:12
  • 1
    This looks like a LiDAR first return dataset. Go to the data source and get the bare-earth surface model (DTM?) and generate the contours from that surface. – GBG Nov 18 '20 at 23:14
  • No lidar data. The DSM was created by mapsmadeeasy.com. I've uploaded the drone images there and received a georeferenced Tif and other files like .mtl .obj .las .kmz and different .jpgs Sorry, complete beginner here. I'd need a concrete advice how to get a DTM and with what kind of software (ideally QGIS or blender) this can be achieved. – Chris Nov 19 '20 at 10:23
  • Create a polygon layer. Digitize the parts you want to keep and the ones you dont. Add a field with value -1 and 1. Convert to raster. Use raster calculator with if else to set the parts you dont want to keep to null. Fill no data to fill the gaps. But the best would of course be to recreate the DEM from the point cloud. – BERA Nov 19 '20 at 18:02
  • Thanks @BERA, could you specify further especially what software you're referring to? Can this all be done in QGIS?

    Again, total newbie here :) thx for patience

    – Chris Nov 23 '20 at 12:18

1 Answers1

1

Create areas of nodata where there are areas you want to remove then fill in the nodata:

  1. Create a polygon layer and digitize the features you want to remove enter image description here
  2. Rasterize the polygon layer with "A fixed value to burn" = 1
  3. Use Raster Calculator to set the values where there are polygons (value 1) to 0, and the other parts to the DEM values:

("Rasterized@1" = 1)*0 + ("Rasterized@1"=0)*"DSM@1"

enter image description here

  1. With gdal translate set the zero's to nodata: enter image description here
  2. Use Fill nodata to fill in the holes: enter image description here

(This is also a method for calculating the volume of things in a DEM. Take the original DEM - filled DEM. Which is what I use it for)

BERA
  • 72,339
  • 13
  • 72
  • 161
  • 1
    Thank you @BERA. Your explanation seems very helpful! I'm going to try it out asap! – Chris Nov 24 '20 at 17:36
  • So i've tried your suggested workflow and got stuck at step 2 (Rasterize polygon layer with a fixed value to burn = 1) but all I ever get is a new layer "OUTPUT" with a min. value = 1.79769e+308 and max. value = -1.79769e+308 (and not min. 0 and max. 1)

    After having tried all the possible combinations (mostly errors in width / height) I've input the value = 1 for all the height / width / output extent (xmin, xmax, ymin, ymax) and the above value is what i get.

    Could you pls point me to the correct parameters for rasterize?

    – Chris Dec 09 '20 at 16:06