EnMAP-Box / enmap-box

EnMAP-Box source code repository. See https://enmap-box.readthedocs.io for documentation
GNU General Public License v3.0
35 stars 16 forks source link

Decorrelation stretch rendering does not work in QGIS 3.36.2 and EnMap-Box 3.14 - Python Errors #892

Closed Bilou020285 closed 4 months ago

Bilou020285 commented 4 months ago

Hello,

I'm trying to use the decorrelation stretch rendering tool on a raster I've load and it seems to have issues on the decorrelationstretchdialog.py code.

I've installed the latest version of QGIS (3.36.2) and the latest version of EnMap Box (3.14).

The error console message :

2024-05-15T13:22:34     WARNING    Traceback (most recent call last):
              File "C:\Users\cfont\AppData\Roaming\QGIS\QGIS3\profiles\caro\python\plugins\enmapboxplugin\enmapbox\coreapps\decorrelationstretchapp\decorrelationstretchdialog.py", line 174, in onApplyClicked
              renderer = self.currentRenderer()
              ^^^^^^^^^^^^^^^^^^^^^^
              File "C:\Users\cfont\AppData\Roaming\Python\Python312\site-packages\typeguard\__init__.py", line 1033, in wrapper
              retval = func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^
              File "C:\Users\cfont\AppData\Roaming\QGIS\QGIS3\profiles\caro\python\plugins\enmapboxplugin\enmapbox\coreapps\decorrelationstretchapp\decorrelationstretchdialog.py", line 96, in currentRenderer
              extent = self.currentExtent()
              ^^^^^^^^^^^^^^^^^^^^
              File "C:\Users\cfont\AppData\Roaming\Python\Python312\site-packages\typeguard\__init__.py", line 1033, in wrapper
              retval = func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^
              File "C:\Users\cfont\AppData\Roaming\QGIS\QGIS3\profiles\caro\python\plugins\enmapboxplugin\enmapbox\coreapps\decorrelationstretchapp\decorrelationstretchdialog.py", line 69, in currentExtent
              mapSettings: QgsMapSettings = self.mMapCanvas.mapSettings()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
             AttributeError: 'NoneType' object has no attribute 'mapSettings'

Do you have any solution to solve this issue ? Thanks for your help ! Best regards. Caroline

janzandr commented 4 months ago

Can't reproduce this. Have you restarted QGIS after updating the EnMAP-Box? If not, please do so and try again.

Bilou020285 commented 4 months ago

I've restarted both QGIS and my computer and the result is still the same.

janzandr commented 4 months ago

Hmm, can you capture your screen showing how to reproduce this? Or explain step by step what you are doing.

Bilou020285 commented 4 months ago

Sure !

![Uploading 2024-05-15_14h27_42.gif…]()

janzandr commented 4 months ago

Can't see the animated GIF.

Bilou020285 commented 4 months ago

Odd, it does not seems to work either... Maybe with PNG...

Adding an image to the canvas : 1

Launching EnMap Box : 2

Launching Decorrelation Stretch Rendering : 3

Selecting the raster and bands : 4

The Python error appears on the top of the canvas : 5

Message appears into the error console : 6

janzandr commented 4 months ago

Alright, now I understand your usecase. Here is a workaround:

  1. It is assumed, that you open the raster inside the EnMAP-Box (and not in QGIS).
  2. If you want to have the styled raster inside QGIS afterwards, do this: image

Nevertheless, it would be good to support styling rasters, that are opened inside QGIS only. Here is a feature request for that: https://github.com/EnMAP-Box/enmap-box/issues/893

Bilou020285 commented 4 months ago

Yes ! It's working ! Wonderful ! Thanks a lot for your help ! 👍