For a suitability analysis I need to define the suitability of slope from DEM values (in %) to build new trails.

Knowledges says that flat and rather steep areas are not suitable due to water runoff. Unfortunately, it is not possible to define threshold like

<5% nogo, 5%<x>60% go, >60% nogo.

So I was thinking about a fuzzy set. I use QGIS and do not want to install GRASS GIS (due to security settings on my macOS). SAGA GIS fuzzify allows to define gradients between 0 (fully flat) and 1, see


andenter image description here

Basically, this works for me. But: For further calculations my output should be in the range from 1 to 5, whereas

0 - 1 = NoGo
1 - 2 = not good
2 - 3 = take care
3 - 4 = good
4 - 5 = must go

So I wanted to recalculate the 0 to 1 gradient from SAGA GIS into my gradient.

0   =! 1
0.5 =! 3
1   =! 4

How can I do this? Is there a better fuzzy logic algorithm available than this one from SAGA GIS (apart from GRASS GIS)?

If I didn't find any solution, I would probably create a discrete assignment between the slope and my categories.

  • 1
    Whats the problem defining a region that satisfies <5% nogo, 5%<x>60% go, >60% nogo? Its a standard raster algebra calculation. Assuming you mean 5% < x < 60%... – Spacedman Jan 24 '18 at 20:18
  • it is the problem one often faces when categories are not clear to separate. think of this: 0-3 is absolute no go, 4 is medium, 5 is go. Okay, I could do more categories. But doing this again: 3.5 is better than 3 and worse than 4. I could – again – create another category. Finally, that would create an indefinite number of categories. And therefore I'd prefer a fuzzy set. – Kevkev770 Jan 25 '18 at 8:38

Basically you are asking how to rescale a raster whose values range from 0-1 into a new range of 1-5, correct? The answer to this question highlights the formula how to do this https://stackoverflow.com/questions/1456000/rescaling-ranges.

Using the formula from that question

x := (c - a) * (z - y) / (b - a) + y

Where the current range is defined as; a = 0, b = 1. The new range is y = 1, z = 5 and c is the pixel value being rescaled. This makes a formula like:

x := (c - 0) * (5 - 1)/ (1 - 0) + y

Which simplifies to

x := 4c + 1

So in the raster calculator in QGIS you need to use the formula like this on the grid.

(raster@band * 4) + 1
  • Thank you @Liam! Basically, this is what I needed...I was just looking at the wrong place, though. I will do (raster@band * 3) + 1as I do not want a "Must Go" in this parameter (I just need the 5 classes for other indicators in my work as well). I will accept the answer as soon as I will have tested it! – Kevkev770 Jan 25 '18 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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