I've got raster with elevations of trees in a forest. I would like to find out the average tree height of all trees in a given area.

Because of the geometry of a tree top (which is like a cone and just the top is my real tree height), common statistic tools (Zonal Statistics or v.rast.stats) doesn't work for me. I need the average of the maximum values.

The raster:

All trees and vegetation below 4m have no data. Even all values above 40m. The yellow area in the north-west seems to have mostly 40m heigh trees, but the statistics (median/mean) say something about 28m.

Any ideas, how to approach this task using QGIS, SAGA, GRASS?

2 Answers 2


There is something called the Topographic Position Index (TPI) that gives values that are more qualitative in nature (i.e. "ridge", "valley", etc). It uses a local neighbourhood function to determine how each cell is related to its neighbours (i.e. cells higher than most or all of their neighours become "ridges", cells lower than most or all of their neighbours become "valleys", etc).

GDAL has a tool for this, and you can find it in Processing Toolbox > GDAL/OGR > Analysis > TPI (Topographic Position Index). Unfortunately it looks like it doesn't take any parameters to determine the optimal cell neighbourhood size, but maybe it does some behind-the-scenes magic to determine an optimal neighbourhood size.

I would suggest using this tool to create a mask of "ridges" as output by this tool. You could then use this to mask out the crests of the trees and/or tree clusters, which could then be used to calculate the "average maximum height", so to speak.

  • Is it possible to convert raster cells to points with value of each raster cells, and you could select range of your highest trees and make average value. I didnot try this it is my suggestion.
    – nagib
    Mar 25, 2018 at 7:37

I found a well suited solution according to this study: http://www.pf.bgu.tum.de/isprs/cmrt05/pub/CMRT05_Tiede_et_al.pdf

The idea is to use a inverted watershed segmentation after filtering the DSM by a radius of the approximate tree top diameter.

Here is a detailed workflow using SAGA: http://dominoc925.blogspot.de/2012/02/simple-method-to-count-trees-using-saga.html

The results: enter image description here

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.