enter image description hereI am struggling with a problem that I cannot solve. I state that I use QGIS 3.16. I have the dtm of a hilly area with 5m x 5m cells. I would like to select all the cells above a height so as to have only the hilly relief and not the countryside area. I thought about this solution to this solution: In QGIS I open the raster calulator, I write the expression dtm> 40 and the result is a binary file 0/1 where with 0 there is what is below while with 1 there is everything what is above. The next step I imagined would be to vectorize the created raster and make a mask clip on the original dtm. But this is not the case: the problem is that the plain to the north of the hills is a few meters higher than the plain to the south. This means that a level of plain in the north (eg a point on the plain with an altitude of 45 m asl) is identical to a level of a hill in the south (a point in a hill at 45 m asl).

How can I go about extracting only the hills?

PS: I don't have the shape of the hills so I need to find an alternative solution.

  • Why is the area to the north not of interest to you when it meets your selection criteria?
    – Erik
    Feb 22, 2022 at 13:55
  • Because it is a plain and not a hill.
    – Filippo
    Feb 22, 2022 at 13:57
  • So your selection criteria ain't simply "must be 40+ m asl".
    – Erik
    Feb 22, 2022 at 14:13
  • @Erik clearly not. That is something that Filippo tried and it didn't produce the desired result. The question is 'How can I go about extracting only the hills?'
    – Matt
    Feb 22, 2022 at 14:21
  • 3
    Read up on Topographic Prominence etc en.wikipedia.org/wiki/Topographic_prominence and work out your definition of a hill.
    – Spacedman
    Feb 22, 2022 at 22:58

3 Answers 3


I would like to suggest two possible answers to your question.

The first would be, would it be possible for you take take the boolean raster (i.e. with 1 = cells above 40 and 0 cells bellow) and multiply that by the original dem. Doing this would "add back" the DEM elevation values (i.e. the hills). You would the have the hills extracted with their original elevation values.

The next possible solution would be to use a measure of Local Topographic Position (LTP) or some sort of Landform Classification tool. I don't know if QGIS has measures of LTP but I do know WhiteboxTools does. There is a plugin that you could download in QGIS (https://www.whiteboxgeo.com/manual/wbt_book/qgis_plugin.html) or you can download WhiteboxTools from their website (https://www.whiteboxgeo.com/).

For example, DifferenceFromMean tool in WhitheboxTools will take difference between the elevation of each grid cell and the mean elevation of the centering local neighbourhood. This could be helpful to identify upland areas (i.e. positive elevation). You could also try DeviationFromMean... this just just the deviation (i.e. normalized by Standard deviation) instead of the difference. There are also multi-scale equivalents for each of these tools, which take the max values over a range of spatial scales.

DiffFromMean (https://www.whiteboxgeo.com/manual/wbt_book/available_tools/geomorphometric_analysis.html#DiffFromMeanElev)

DevFromMean (https://www.whiteboxgeo.com/manual/wbt_book/available_tools/geomorphometric_analysis.html#devfrommeanelev)

MaxDiffFromMean (https://www.whiteboxgeo.com/manual/wbt_book/available_tools/geomorphometric_analysis.html#maxdifferencefrommean)

You could also try a Landform Classification tool as well. Something like Geomorphons or Pennock Landform Classification. These tools wont necessarily compute elevation values but instead will provide numeric/class values to represent the underlying feature. For Geomorphons, it will classify values by the following: Flat, Peak, Shoulder, Ridge, Convex, Slope, Concave, Footslope, Valley and Pit. It may be possible for you to use some combination of Peak, Shoulder and Ridge to potential extract "hills".

Geomorphons (https://www.whiteboxgeo.com/manual/wbt_book/available_tools/geomorphometric_analysis.html#geomorphons)

Pennock Landform Classification (https://www.whiteboxgeo.com/manual/wbt_book/available_tools/geomorphometric_analysis.html#pennocklandformclass)


I used the following expression:

("DTM_Colliberici @ 1" <= 40) * -9999 + ("DTM_Colliberici @ 1"> 40) * "DTM_Colliberici @ 1"

so as to have no data values external to the hills and the altitude of each point on the hill.

Finally I used smaller parts of the DTM and joined them together at the end of the extraction.

The model needs improvement but it seems to work.


Detrend your surface model before running your raster calculation. See this link for more information on detrending. Here is a link for detrending in QGIS. If you can get a hold of a copy of ArcGIS or ArcGIS Pro you can use these toolbox tools for detrending, or these tools.

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.