1

I have a raster layer with values ranging from 0.00597303 to 0.102894 and I want to assign specific number representing a group to specific range of values:

Group 4: x >= 0.1
Group 3: 0.01 <= x < 0.1
Group 2: x < 0.01

I am using the following syntax:

("Ri_Q50@1" >= 0.1) * 4 + (("Ri_Q50@1" >= 0.01) AND ("Ri_Q50@1" < 0.1)) * 3 + ("Ri_Q50@1" < 0.01) * 2

However, the output file only has assigned group 2 and 3 but not the 4th group (x >= 0.1). What could be the reason?

Note: When I use the Raster pixels to points and check the output point layer there is 12 points having exceeded the condition for 4th group - ie 12 pixels has value above 0.1).

  • I am using Qgis. – Petr Jul 30 at 13:53
  • Welcome to GIS:SE @Petr! Your expression looks fine, which QGIS version are you using? – Joseph Jul 30 at 14:04
  • I've tried 3.4 long term release and 3.8 Zanzibar but both gives the same output. Any ideas? – Petr Jul 31 at 6:50
0

As an alternative of Raster Calculator, you can use Reclassify by table tool from Processing toolbox -> Raster Analysis -> Reclassify by table. Then use the range of values that you want to reclassify to integer values as you can see in the example below:

enter image description here

Make sure to select the correct Range boundaries from the tool above. This example uses min < value <= max. You may need to change it based on your desired analysis.

  • Thanks for tip, however the Range boundaries of this tool does not allow me to reclassify the raster according to my needs: Group 4: x >= 0.1 Group 3: 0.01 <= x < 0.1 Group 2: x < 0.01 – Petr Aug 1 at 10:23

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.