Bug report #11682

Raster calculator produces only 0 values with conditional expression

Added by Andreas Neumann over 9 years ago. Updated about 9 years ago.

Category:Raster Calculator
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:19926


Steps to reproduce:

1. Download file from http://webgis.uster.ch/temp/temp_test.tif

2. Create a new project and set EPSG:21781 as projection

3. Open the raster file in the project

4. Open the raster calculator and use the following expression:
(temp_test@1=249)*255 + (temp_test@1<249)*temp_test@1 + (temp_test@1>249)*temp_test@1

Expected outcome is that all raster values with value 249 are replaced with 255 and all other values would stay as they are. The actual outcome is that all values are set to zero.

Related issues

Related to QGIS Application - Feature request #7581: raster calculator really needs support for conditional st... Open 2013-04-11
Related to QGIS Application - Bug report #10965: Raster calculator always returns float32 tiffs Closed 2014-07-28

Associated revisions

Revision b35a596a
Added by Jürgen Fischer about 9 years ago

raster calculator: allow unquoted raster references (fixes #11682)


#1 Updated by Andreas Neumann over 9 years ago

Carlos Cerdan suggests in this thread ( http://lists.osgeo.org/pipermail/qgis-user/2014-November/029847.html ) that I may have to reproject my data before using the raster calculator. However, this did not really helps and should not be necessary.

#2 Updated by Giovanni Manghi over 9 years ago

  • Target version set to Version 2.8

it is a blocker because in qgis 2.8 works as expected.

Anyway the qgis raster calculator is kind of rubbish, especially when it comes to reclassifying rasters, and should deserve much more attention (like the raster georeferencer; see also #7581 and #10965)

#3 Updated by Giovanni Manghi over 9 years ago

  • Affected QGIS version changed from 2.6.0 to master

#4 Updated by Jürgen Fischer about 9 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF