1

I am working with the plugin RiverGIS, which in one steps reads the layer ID of all raster layers. In my case it fails becuase there is an "ä" somewhere.

Traceback (most recent call last):
File "C:/Users/XXXXX/.qgis2/python/plugins\rivergis\rivergis.py", line 344, in options
dlg = DlgSettings(self, widget=widget)
File "C:/Users/XXXXX/.qgis2/python/plugins\rivergis\dlg_settings.py", line 58, in __init__
item = QStandardItem('{0}'.format(layer.name())) #layerId
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 135: ordinal not in range(128)

I do not see it anywhere in the Layers Panel, but I can read that is everywhere in the .qgs file related with Swedish WMS service:

<layer-tree-layer expanded="1" providerKey="wms" checked="Qt::Unchecked" id="Hydrografi_ytor_nedtonad_default_Text_nedtonad_Adresser_Adresser_nedtonad_Administrativ_indelning_Administrativ_indelning_nedtonad_Bestämmelser_Bestämmelser_nedtonad_Bebyggelse_Bebyggelse_nedtonad_Anläggningar_Anläggningar_nedtonad_Kraftledningar_Kraftledningar_nedtonad_Fjällinformation_Fjallinformation_nedtonad_Järnväg_Järnväg_nedtonad_Kommunikation_Kommunikation_nedtonad_Hydrografi_Hydrografi_nedtonad_Kurvor_Kurvor_nedtonad_Hydrografi_ytor_mark_default20180215162518119" source="contextualWMSLegend=0&amp;crs=epsg:4619&amp;dpiMode=7&amp;featureCount=10&amp;format=image/png&amp;layers=mark&amp;layers=hydrografi_ytor&amp;layers=kurvor_nedtonad&amp;layers=kurvor&amp;layers=hydrografi_nedtonad&amp;layers=hydrografi&amp;layers=kommunikation_nedtonad&amp;layers=kommunikation&amp;layers=jarnvag_nedtonad&amp;layers=jarnvag&amp;layers=fjallinformation_nedtonad&amp;layers=fjallinformation&amp;layers=kraftledningar_nedtonad&amp;layers=kraftledningar&amp;layers=anlaggningar_nedtonad&amp;layers=anlaggningar&amp;layers=bebyggelse_nedtonad&amp;layers=bebyggelse&amp;layers=bestammelser_nedtonad&amp;layers=bestammelser&amp;layers=administrativ_indelning_nedtonad&amp;layers=administrativ_indelning&amp;layers=adresser_nedtonad&amp;layers=adresser&amp;layers=text_nedtonad&amp;layers=hydrografi_ytor_nedtonad&amp;password=xxxxxx&amp;styles=mark.default&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=&amp;styles=hydrografi_ytor_nedtonad.default&amp;url=http://maps.lantmateriet.se/topowebb-skikt/wms/v1.1?request%3DGetCapabilities%26version%3D1.1.1&amp;username=xxxx" name="Hydrografi_ytor_nedtonad.default/Text nedtonad/Adresser/Adresser nedtonad/Administrativ indelning/Administrativ indelning nedtonad/Bestämmelser/Bestämmelser nedtonad/Bebyggelse/Bebyggelse nedtonad/Anläggningar/Anläggningar nedtonad/Kraftledningar/Kraftledningar nedtonad/Fjällinformation/Fjallinformation nedtonad/Järnväg/Järnväg nedtonad/Kommunikation/Kommunikation nedtonad/Hydrografi/Hydrografi nedtonad/Kurvor/Kurvor nedtonad/Hydrografi-ytor/mark.default">

I do not consider an option to wait for the bug of the plugin to be fixed or to remove and load all layers of the WSM witout an easy way to achieve it.

1 Answer 1

1

It was not very elegant, but I learned how to restore a large group of layers in a single step.

  1. I put all WSM layers in a group

  2. save the group as a layer definition file

  3. removed the group do the operation that was giving the error

  4. restore the group by dragging the definition layer ile into Qgis (also possible with the menu Layer -> Add from Layer Definition File...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.