# Reclassify raster values continuously instead of assigning them to specific groups

I want to create a Habitat Suitability Index (HSI). I have several variables (raster layers containing information about e.g. precipitation, slope, food resources, etc.).

I have to create an "index" for each raster layer. That means that i have to reclassify all layers on a scale from 0 to 1, where 0 is not suitable and 1 is really suitable. This is were I am stuck. I know how to reclassify data in terms of assigning values to specific classes. But for some variables, I have to create a continuous index

I have troubles explaining, since english is not my first language and I'm new to the topic, but I will try:

I need to reclassfy the data continuously, according to my guidelines. For example altitude (image 1): The plot below shows, how i have to reclassify altitude. in summer, an altitude from 1200 to 1500 meter is perfect, for higher altitues the HSI slowly decreases, but not linear unfortunately. This is the same for example for the index for the crown projection (second image). I have to reclassify the values on a scale from 1 to 100, but again, it is not linear.  My first thought was to apply some kind of funtion on the raster, but unfortunately, I could not find the right answer on google, so I'm afraid I'm searching for the wrong keywords.

I am using QGIS (3.16.1 and 3.10.13), I am quite experienced in SAGA, GDAL, Grass and OTB and I have a bit of knowledge in R.

I think you're looking for the Raster Calculator tool. It will let you apply an equation to each raster. What that equation is (i.e. what function defines the curved line in each graph above) you'll have to figure out based on your research or other literature on the subject.

Then you can also use Raster Calculator to combine your variables once they are in a 0-1 scale. If all variables have equal weight this would just be a simple sum, but if for example elevation is twice as important as vegetation you could do something like (2*elevation + vegetation).

I didn't find how to put conditions with equations in the qgis raster calculator, so I wrote a tutorial to help you in ArcGIS. ArcGIS has free 21-day trial, he just needs your sign up (ArcGIS trial). I use the ArcGIS Desktop but ESRI developed the ArcGIS PRO too, both presents free trials.

I have worked with the summer line and defined some inflection points. With the point data, I used the Excel to calculated the line equation (I'm too lazy to do it by hand), and, then I wrote the condition equations to implement in Raster Calculator.  The equations are:

``````Con((Topo > 0) & (Topo < 1500), 1, 0)
Con((Topo > 1500) & (Topo < 1700), -0.001*Topo + 2.5, 0)
Con((Topo > 1700) & (Topo < 1900), -0.0015*Topo + 3.35, 0)
Con((Topo > 1900) & (Topo < 2000), -0.001*Topo + 2.4, 0)
Con((Topo > 2000) & (Topo < 5000), 0, 0)
>>> Place your raster name in Topo
``````

I uploaded the data and a model with the equations, you hust need to input with your data.

After you install the ArcGis:

1. Open ArcGIS Catalog
2. Click in Connect to Fold (a folder with plus sign)
3. Go to the folder where you save my data
4. Click in the Workflow
5. Click with mouse right botton in the HSI_model and Edit
6. Replace my input file

My results are here:

The second task, you may use Large (or MSLarge) function in Fuzzy Membership with Mean in 55. In parameter spread you will have to test the values. The documentation is here All file are in my github

And good luck :)

• thank you so much! I have to do it more often in the future, so I can't do it on ArcMap, but i managed to adapt your method in QGIS. Jan 10, 2021 at 17:13

I think you may use the Fuzzy function in Grass or Arc-SDM3. In this way, you could input several condition.

1. Fuzzy example is here.
Another option is the GRASS GIS module `r.rescale` (manual page), available in the Processing Toolbox. You set the minimum and maximum values that you want, and all (continuous) raster values are scaled to that range.
``````r.rescale input=elev output=elev_rescaled to=0,1