Bug report #19229

Reference layer is not optional in raster calculator

Added by Mario Reyes over 5 years ago. Updated over 5 years ago.

Status:Open
Priority:Normal
Assignee:-
Category:Processing/QGIS
Affected QGIS version:3.0.3 Regression?:No
Operating System:Windows 10 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:27058

Description

When the raster calculator from the processing toolbox is used for example to sum two rasters, the following error message is displayed>

Traceback (most recent call last):
File "C:/PROGRA~1/QGIS3~1.0/apps/qgis/./python/plugins\processing\algs\qgis\RasterCalculator.py", line 136, in processAlgorithm
raise QgsProcessingException(self.tr("No reference layer selected nor extent box provided"))
_core.QgsProcessingException: No reference layer selected nor extent box provided

If an optional layer is provided, which specifies the output extent and CRS there's no problem.

History

#1 Updated by Mario Reyes over 5 years ago

I forgot to mention I'm using a custom CRS.

#2 Updated by Harrissou Santanna over 5 years ago

  • Status changed from Open to Feedback

Actually the reference layer on one hand and the (cell size + extent) on the other are kind of mutually exclusive optional parameters. I mean you should either fill a reference layer and/or fill the other parameters. See https://github.com/qgis/QGIS-Documentation/pull/2443#issuecomment-373882292 . It's a false optional due to the fact that the GUI cannot yet display relations between parameters.
Does it work to you?

#3 Updated by Mario Reyes over 5 years ago

Harrissou Santanna wrote:

Actually the reference layer on one hand and the (cell size + extent) on the other are kind of mutually exclusive optional parameters. I mean you should either fill a reference layer and/or fill the other parameters. See https://github.com/qgis/QGIS-Documentation/pull/2443#issuecomment-373882292 . It's a false optional due to the fact that the GUI cannot yet display relations between parameters.
Does it work to you?

Yes, it works, but I think the actual approach is not user friendly. There is another discussion here #19553.

#4 Updated by Giovanni Manghi over 5 years ago

  • Status changed from Feedback to Open

Does it work to you?

actually I think (after having used it again after #19553) that how the calculator works now is really cumbersome:

the parameters are all listed as optional, but in truth you have always mandatory ones. For exemple I have now noticed that cell size, output CRS and output extent are all mandatory.

Moreover when a user forgets an parameter the result is a python error! Not the most usefriedly thing. Usability wise is a step backwards (yes I know, not is in Processing that is a huge step forward, but yet...).

#5 Updated by Mario Reyes over 5 years ago

Giovanni Manghi wrote:

Does it work to you?

actually I think (after having used it again after #19553) that how the calculator works now is really cumbersome:

the parameters are all listed as optional, but in truth you have always mandatory ones. For exemple I have now noticed that cell size, output CRS and output extent are all mandatory.

Moreover when a user forgets an parameter the result is a python error! Not the most usefriedly thing. Usability wise is a step backwards (yes I know, not is in Processing that is a huge step forward, but yet...).

I think one of the problems is that the behaviour is not according to the documentation. For example, if no CRS is provided it should take the CRS of the first layer, which is not happening at least in 3.2.2. Anyway, it seems there is a QEP that deals with this issue, if I am not wrong.

#6 Updated by Alister Hood over 5 years ago

Also note that if you try to run the raster calculator a second time without closing and reopening, or selecting a different reference layer*, then you get this error: "Unable to execute algorithm. Incorrect parameter value for LAYERS".

*actually, after you run it the first time, the reference layer is listed twice, so you can select the other instance as a reference layer, and it will run without error. But then you would need to change the selection again to run it a third time, etc.

Re this see #18214

#7 Updated by Alessandro Pasotti over 5 years ago

  • Category changed from Raster Calculator to Processing/QGIS

Also available in: Atom PDF