-
Notifications
You must be signed in to change notification settings - Fork 19
Description
First of all, I am creating this issue here, but you may decide whether it may be rather moved against QGIS Desktop.
I have made the attached QGIS project "Modena1.qgs" having a layer defined on a database table in a postgres/postGIS databsase.
Modena1.zip
Layer items are categorized by the entity field called "modello".
When categorizing the layer in QGIS Desktop (by Layer -> Layer Properies + Symbols -> Categorized and then Classify button), QGIS Desktop adds a "default" layer mapping items having field values different from those identified at creation time.
Looking into the QGIS file I can see that this "default" layer misses both "label" and "value" attributes:
<categories>
<category symbol="0" label="Arduino" value="Arduino" render="true"/>
<category symbol="1" label="ESP-32" value="ESP-32" render="true"/>
<category symbol="2" label="Raspberry" value="Raspberry" render="true"/>
<category symbol="3" label="" value="" render="true"/>
</categories>
When trying to import this project by means of the qwc-admin, the layer import phase will fail and the layer will not be imported. If this is the only layer in the project, the whole project will not be imported.
After investigation, I ascertained that this is caused by an exception in resources_controller.py when importing the categorized symbols as map's layers (line 442):
# add additional maps to ConfigDB
new_maps = sorted(list(set(maps_from_config) - set(maps)))
This fails with exception when sorting the list with an item having label as None (the "default" category)
My suggestion is either to handle upfront the case of an empty labelled layer before calling sorted()
Or addressing the issue within QGIS Desktop