planetfederal / qgis-geoserver-plugin

GNU General Public License v2.0
62 stars 52 forks source link

Error when publishing project with a especified group #96

Closed SrNetoChan closed 6 years ago

SrNetoChan commented 6 years ago

When I try to publish a project with several layers (with simple symbols only) and add a global group at the same time, I get this error:

TypeError: 'dict_values' object is not subscriptable 
Traceback (most recent call last):
  File "/home/aneto/.local/share/QGIS/QGIS3/profiles/default/python/plugins/geoserverexplorer/gui/gsexploreritems.py", line 600, in 
    publishProjectAction.triggered.connect(lambda: self._publishProject(tree, explorer))
  File "/home/aneto/.local/share/QGIS/QGIS3/profiles/default/python/plugins/geoserverexplorer/gui/gsexploreritems.py", line 573, in _publishProject
    publishProject(tree, explorer, self.element)
  File "/home/aneto/.local/share/QGIS/QGIS3/profiles/default/python/plugins/geoserverexplorer/gui/gsoperations.py", line 129, in publishProject
    names = [layer.name() for layer in layers[::-1]]
TypeError: 'dict_values' object is not subscriptable

All layers are correctly added to the chosen workspace, but no group is created.

This does not happen if I leave the global group name empty.

Tested in geoserver 2.12 and 2.13

volaya commented 6 years ago

Should be fixed now. Please retest

SrNetoChan commented 6 years ago

@volaya Now I get the following error.

"
An error has occurred while executing Python code: 

AttributeError: 'QgsCoordinateReferenceSystem' object has no attribute 'QgsProject' 
Traceback (most recent call last):
  File "/home/aneto/.local/share/QGIS/QGIS3/profiles/default/python/plugins/geoserverexplorer/gui/gsexploreritems.py", line 600, in 
    publishProjectAction.triggered.connect(lambda: self._publishProject(tree, explorer))
  File "/home/aneto/.local/share/QGIS/QGIS3/profiles/default/python/plugins/geoserverexplorer/gui/gsexploreritems.py", line 573, in _publishProject
    publishProject(tree, explorer, self.element)
  File "/home/aneto/.local/share/QGIS/QGIS3/profiles/default/python/plugins/geoserverexplorer/gui/gsoperations.py", line 131, in publishProject
    layergroup = catalog.create_layergroup(groupName, names, names, getGroupBounds(layers))
  File "/home/aneto/.local/share/QGIS/QGIS3/profiles/default/python/plugins/geoserverexplorer/gui/gsoperations.py", line 154, in getGroupBounds
    transform = QgsCoordinateTransform(layer.crs(), QgsCoordinateReferenceSystem("EPSG:4326"). QgsProject.instance())
AttributeError: 'QgsCoordinateReferenceSystem' object has no attribute 'QgsProject'
"

The group is created in the geoserver explorer tree, but if you confirm in geoserver, the group does not exist. This might be related to the fact some layers don't have a EPSG defined. Will test that.

SrNetoChan commented 6 years ago

This is solved. Closing