Bug report #17847

Processing Raster Calculator - Problem with spaces in layers name

Added by Pedro Venâncio 6 months ago. Updated 5 months ago.

Assignee:Victor Olaya
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No


The new Processing Raster Calculator in QGIS 3 (Raster Analysis -> Raster Calculator) does not put the input layer name between double quotes, when double-clicking in the layers name list (like the Raster menu -> Raster Calculator does).

And so, when the layer name has spaces, the algorithm gives an error parsing the formula.

processing.run("qgis:rastercalculator", {'EXPRESSION':'Dem Srtm Pttm06 [email protected] *  1 ','CELLSIZE':0,'OUTPUT':'C:/Users/PedroVenancio/AppData/Local/Temp/processing_c1f8e832dfd0477699ef25f15f41224d/90cbf438721249689c67c573ed894824/OUTPUT.tif'})

With the double quotes, it works well:

processing.run("qgis:rastercalculator", {'EXPRESSION':'"Dem Srtm Pttm06 [email protected]" *  1 ','CELLSIZE':0,'OUTPUT':'C:/Users/PedroVenancio/AppData/Local/Temp/processing_c1f8e832dfd0477699ef25f15f41224d/372ee79ce08b43038336049cb24f25b0/OUTPUT.tif'})

Associated revisions

Revision 490aad11
Added by Alexander Bruy 6 months ago

[processing] quote layer names in raster calculator (fix #17847)


#1 Updated by Alexander Bruy 6 months ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

#2 Updated by Giovanni Manghi 5 months ago

  • Resolution set to fixed/implemented

Also available in: Atom PDF