I need to classify tree heights in a DSM of a slope-y terrain. It´s not a forest but several individual / detached trees. In a plane terrain it won´t be an issue but in that uneven terrain I need somehow to extract the height of the single trees as related to the surrounding ground.

Is there any way to do so using QGIS?

The DSM file is a Tiff, but I can also get it as a point model if this helps.

  • Are you sure its a DTM you have? as a DTM won't have tree heights. What you need is a DSM. What you actually need is both and then you deduct from the other in the raster calculator. check this answer out for better understanding: gis.stackexchange.com/a/5704/73835 Apr 27, 2017 at 12:08
  • Sorry, i confused the phrases. Sure I mean a DSM. My understanding was DTM = DSM and what you mentioned as DTM equals a DEM... Anyway. I just have the DSM. As it is produced by photogrammetry I only have the DSM. Is there any way to do it without having a DTM?
    – Andreas
    Apr 27, 2017 at 12:47
  • DSM = with land features e.g. houses trees, cars etc. DTM = terrain with all the features removed. Both are a type of DEM. The only thing I can think might work for you is using the 'Fill Sinks' tool. It's meant to be used for hydrology analysis removing sharp peaks or troughs in the landscape. But if your trees are tall/separate enough, you might be able to use the Fill Sinks product layer as a difference and deduct that from your DSM and identify the tall areas that have been removed (i.e. the trees). But as your DSM is over rough terrain you'll most likely get a lot of rubbish as well. Apr 27, 2017 at 13:37

1 Answer 1


one possible approach (assumes you have DSM as raster, and no DTM).

I've tried this on a local park (Princes Street Gardens in Edinburgh). It's probably a bad example as it's not on a continuous slope, but is a U-shaped park with a deep square notch in the middle where the railway is. I haven't taken too much time with the settings.

Here's the original raster:-

enter image description here

  • SAGA DTM (Slope) filter. This spits out two rasters, bare earth (trees replaced with nodata) and removed objects (trees only, terrain replaced with nodata). You'll need to experiment with radius and slope settings for this to get good results.

  • use SAGA close gaps on the bare earth output. This will give a reasonable approximation to the underlying DTM, by interpolating pixels in the gaps where the trees were removed.

enter image description here

  • use Raster Calculator to subtract the DTM from your original DSM. You now have a raster representing height above the underlying terrain, and the (sloped) treeless ground has values close to 0...

enter image description here

it's done a reasonable job picking out the trees, although it's also picked out a bridge and a building :) It seems the trees are around 18-20m high, which sounds about right.

  • That works very well!
    – Andreas
    May 3, 2017 at 9:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.