Skip to main content
added 79 characters in body
Source Link
Steven Kay
  • 20.6k
  • 5
  • 34
  • 82

Make sure you use the "A1@1" notation. This tells QGIS to use band 1 of raster A1.

It looks as if Raster Calculator allows you to just use A1, but the end results are all 1 (at least for me, QGIS 2.18.10), or all 0 if I use "A1".

You should be able to do this in one step without needing multiple intermediate rasters.

A1 > 5 and 30 <= B1 <= 45

should be doable as

( ("A1@1" > 5) + ("B1@1" >= 30) + ("B1@1"<=45) ) = 3

or as

( ("A1@1" > 5) * ("B1@1" >= 30) * ("B1@1"<=45) ) 

this is how I convert boolean logic into raster calc terms:-

a and b = a*b
a or b = (a+b)>0

Also, the fact you're seeing 0.99 suggests you need to use Contrast Enhancement, Stretch to min/max, and Load min/max values. That should fix the legend to show 0/1 and show the raster in black and white.

You also mentioned the rastercalc plugin. This has vanished from the Plugin Manager, it seems to still be available. The source is no longer available, it would need to be installed manually, and it's tagged as being for QGIS 1.x , so I suspect it's been withdrawn. At the time, QGIS raster calculator was a lot less powerful. I think most of those features and functions are available via r.mapcalc , SAGA's Grid Calculator and indeed QGIS Raster Calculator itself.

Make sure you use the "A1@1" notation. This tells QGIS to use band 1 of raster A1.

It looks as if Raster Calculator allows you to just use A1, but the end results are all 1 (at least for me, QGIS 2.18.10), or all 0 if I use "A1".

You should be able to do this in one step without needing multiple intermediate rasters.

A1 > 5 and 30 <= B1 <= 45

should be doable as

( ("A1@1" > 5) + ("B1@1" >= 30) + ("B1@1"<=45) ) = 3

or as

( ("A1@1" > 5) * ("B1@1" >= 30) * ("B1@1"<=45) ) 

this is how I convert boolean logic into raster calc terms:-

a and b = a*b
a or b = (a+b)>0

Also, the fact you're seeing 0.99 suggests you need to use Contrast Enhancement, Stretch to min/max, and Load min/max values.

You also mentioned the rastercalc plugin. This has vanished from the Plugin Manager, it seems to still be available. The source is no longer available, it would need to be installed manually, and it's tagged as being for QGIS 1.x , so I suspect it's been withdrawn. At the time, QGIS raster calculator was a lot less powerful. I think most of those features and functions are available via r.mapcalc , SAGA's Grid Calculator and indeed QGIS Raster Calculator itself.

Make sure you use the "A1@1" notation. This tells QGIS to use band 1 of raster A1.

It looks as if Raster Calculator allows you to just use A1, but the end results are all 1 (at least for me, QGIS 2.18.10), or all 0 if I use "A1".

You should be able to do this in one step without needing multiple intermediate rasters.

A1 > 5 and 30 <= B1 <= 45

should be doable as

( ("A1@1" > 5) + ("B1@1" >= 30) + ("B1@1"<=45) ) = 3

or as

( ("A1@1" > 5) * ("B1@1" >= 30) * ("B1@1"<=45) ) 

this is how I convert boolean logic into raster calc terms:-

a and b = a*b
a or b = (a+b)>0

Also, the fact you're seeing 0.99 suggests you need to use Contrast Enhancement, Stretch to min/max, and Load min/max values. That should fix the legend to show 0/1 and show the raster in black and white.

You also mentioned the rastercalc plugin. This has vanished from the Plugin Manager, it seems to still be available. The source is no longer available, it would need to be installed manually, and it's tagged as being for QGIS 1.x , so I suspect it's been withdrawn. At the time, QGIS raster calculator was a lot less powerful. I think most of those features and functions are available via r.mapcalc , SAGA's Grid Calculator and indeed QGIS Raster Calculator itself.

Source Link
Steven Kay
  • 20.6k
  • 5
  • 34
  • 82

Make sure you use the "A1@1" notation. This tells QGIS to use band 1 of raster A1.

It looks as if Raster Calculator allows you to just use A1, but the end results are all 1 (at least for me, QGIS 2.18.10), or all 0 if I use "A1".

You should be able to do this in one step without needing multiple intermediate rasters.

A1 > 5 and 30 <= B1 <= 45

should be doable as

( ("A1@1" > 5) + ("B1@1" >= 30) + ("B1@1"<=45) ) = 3

or as

( ("A1@1" > 5) * ("B1@1" >= 30) * ("B1@1"<=45) ) 

this is how I convert boolean logic into raster calc terms:-

a and b = a*b
a or b = (a+b)>0

Also, the fact you're seeing 0.99 suggests you need to use Contrast Enhancement, Stretch to min/max, and Load min/max values.

You also mentioned the rastercalc plugin. This has vanished from the Plugin Manager, it seems to still be available. The source is no longer available, it would need to be installed manually, and it's tagged as being for QGIS 1.x , so I suspect it's been withdrawn. At the time, QGIS raster calculator was a lot less powerful. I think most of those features and functions are available via r.mapcalc , SAGA's Grid Calculator and indeed QGIS Raster Calculator itself.