- changed status to open
after removing all MapViews, old layers from processing are still visible in MapLayerComboBox widgets
How to reproduce:
- open enmap_berlin in a MapView
- use GDAL Translate algo to create a copy
- close all MapView
Now, the MapLayerComboBox widgets should be empty again. Instead we still see the old layer from processing:
With time, the layer list gets bigger and bigger, even after closing all Data Sources and Map Views:
Comments (29)
-
-
reporter I’m using the stand-alone version, where there is no QGIS at all
-
reporter Alright, when QGIS is running, I can see those layers in the Layers panel and delete them manually.
-
reporter Can you prevent that the layers are opened in QGIS in the first place? Or don’t we have controll over that?
-
reporter I see, the user would need to always uncheck those boxes:
-
reporter Issue
#939was marked as a duplicate of this issue. -
I don’t know. Have you looked into the processing framework code if this is possible?
-
reporter How about a button that removes all QgsProject.mapLayers() that aren’t owned by the EnMAP-Box? Simple and easy.
-
Is this a serious suggestion?
-
This seems to be related to the way how QGIS processes QgsProcessingAlgorithm. So I thinks it’s better if you find a solution for, as as you have already developed most (if not all) of our QgsProcessingAlgorithms.
-
reporter Is this a serious suggestion?
Why not? A common usecase is to just use the EnMAP-Box with a minimized QGIS.
-
reporter I would suggest you check the processing panel:
If you can’t prevent QGIS from loading the layers into the QgsProject.mapLayers() list, I would really suggest the “Close non-EnMAP-Box layer” button, which I’m happy to implement.
-
This look to me like implementing a dirty workaround that could remove potentially important project layers (e.g. those created by other QGIS projects or were users spend hours to setup a sophisticated layer styling)
I would prefer to discuss this in the following order:
1. how would the optimal solution look like?
2. how can we achieve this optimal solution? This requires to better understand the QGIS API, e.g. why such layers are loaded to the QGIS layer. QGIS is open source - just check QGIS\python\plugins\processing processing
3. if the optimal solution is too complicated, what would be a solution with less negative side-effects?
-
addressing 1., it could be an idea to show processing framework results which have been started from the EnMAP-Box within the EnMAP-Box only.
In principle this should be possible running these processing algorithms with a modified QgsProcessingContext. -
reporter addressing 1., it could be an idea to show processing framework results which have been started from the EnMAP-Box within the EnMAP-Box only.
Sounds very good!
-
However, it probably requires some upstream fixes in QGIS, as their processing plugin python assumes in several places that QgsProject is QgsProject.instance()
-
reporter As a workaround for now: remove non-EnMAP-Box layer here:
-
fixed remove dock views addresses
#36addresses#937→ <<cset 378f512c445f>>
-
To show EnMAP-Box maplayers only use QgsMapLayerComboBox().setProject(enmapbox.project())
-
Wow! that’s really handy! no option in the GUI? Something like “Show EnMapBox maplayer only”?
If the user is using EnMapBox, should this not be the default?
-
reporter To show EnMAP-Box maplayers only use QgsMapLayerComboBox().setProject(enmapbox.project())
@Benjamin Jakimow no, that isn’t a good solution. When I manually add a layer to QGIS, I want to be able to select that layer in the QgsMapLayerComboBox widget.
-
According to the title of this isse you don’t want to see layers which are not opened in the EnMAP-Box.
So I don’t get the problem. -
reporter Yes, QgsMapLayerComboBox().setProject(enmapbox.project()) will solve the problem described in the title.
BUT: it will introduce a new problem. When I manually add a layer to QGIS, this layer can’t be selected anymore.
-
@alobo that option became possible with https://github.com/qgis/QGIS/pull/46706 It’s available since QGIS 3.24
The set of layers within EnMAP-Box().project() should always be a subset of the layers in QgsProject.instance() -
@Andreas Janz indeed. because its in QGIS but not the EnMAP-Box. Just add it to a EnMAP-Box layer tree and it will become available.
-
reporter Alright, yes, the QgsMapLayerComboBox().setProject(enmapbox.project()) option is a possible way to go.
BUT: it would be better, if the result layers from processing algorithms executed from within the EnMAP-Box wouldn’t be opened in the QGIS Layers panel, in the first place. But I guess, we can’t fix that behaviour easily?
-
I think you better create a new issue for this.
-
reporter As you wish, here is the follow-up issue: #1068
-
- changed status to closed
- Log in to comment
How does the QGIS layer tree look like, does it still contains the layer which is removed from the EnMAP-Box layer tree?