2

I have a raster file (DEM) whose values range from 0 to 1565 meters (elevation). I want to extract a new raster file after classifying the values in four classes like this:

<= to 150 meters
150-600 meters
600-900 meters
>900 meters

after that I want to make statistical calculations.

How can I do this in QGIS?

I have installed the LecoS plugin and I probably don't have the NumPy, SciPy, Pip libraries installed, because it doesn't work.

  • How can I see if I have these libraries?
  • How do I install these libraries, if I don't have them?
  • Is there an easiest way to extract a classified raster file?

I have Windows 7 Pro (64-bit) and QGIS 2.18.7

1

There is an easy way to reclassify a raster in QGIS using GRASS tool r.reclass. When you installed QGIS you probably installed GRASS as well. In the processing toolbox of QGIS go to GRASS/raster/r.reclass

enter image description here

Select the input raster layer, and then you can open a txt file containing reclassification rules. If you want 4 classes the file must contain the following:

1   thru    150 =   1
151 thru    600 =   2
601 thru    900 =   3
901 thru    1565    =   4
  • Sorry, I am not familiar with GRASS GIS. I have just started in QGIS. Any other ideas? Perhaps using Raster Calculator? – Evgenia Aug 27 '18 at 8:58
  • Don’t worry, you don´t have to work in GRASS, its functionalities are implemented in QGIS. Open QGIS and press Ctrl+Alt+T to open the Processing toolbox (if it is not open already). Then type ‘r.reclass’ in the search bar to find the tool. – HMSP Aug 27 '18 at 9:29
  • This seems easy, but, why don't I see any results? Shouldn't I give a name to my new reclassified raster in Reclassified field? Even though I'm doing this, I get no result in return. Nothing appears on my screen and nothing is saved anywhere. What am I doing wrong? – Evgenia Aug 29 '18 at 8:42
  • Instead of GRASS, I used SAGA (2.3.2) Raster tools and it worked at last! Thank you for your time! – Evgenia Aug 29 '18 at 10:12
1

QGIS 3.2 has native, simple to use reclassification algorithms available through the processing toolbox.

  • sorry, I'm working with a company's computer device. It's not easy for me to download new editions. – Evgenia Aug 27 '18 at 9:14
0

You can check this out. Go to QGIS Processing Toolbox, then follow the snaps. Hope this will help Snap 1 Snap 2

  • SAGA (2.3.2) Raster tools > Reclassify values (simple) worked for me! Thank you! – Evgenia Aug 29 '18 at 10:04
0

It worked for me using the steps below.... Check min max values in first raster (dem), Use Processing Toolbox > SAGA (2.3.2) > Reclassify values (simple) Grid = dem (my first raster), Replace Condition = [2] Low value <=grid valueLookup table = a fixed table with 4 rows created in Fixed table window, Changed Grid = Save to temporary file, Check on Open output file after running algorithm Run (algorithm) The Changed Grid raster appears on project.

After that arrange the style through properties and save as dem_reclass.tif After that statistical analysis can be made through LecoS plugin (if it is installed)

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.