[GIS] Loading PostGIS raster layer into QGIS

postgispythonqgisrasterunicodedecodeerror

I am unable to load a PostGIS raster layer into QGIS. I have looked through previous posts Loading raster from PostGIS DB into QGIS
and Cannot add the PostGIS raster layer with QGIS but was not able to solve the problem.

I tried both on QGIS Lisboa 1.8.0 and QGIS Dufour 2.0.1. In the Lisboa version I installed the plugin "Load PostGIS Raster to QGIS" 0.5.4 but I get the following error

An error has occurred while executing Python code:

Traceback (most recent call last):
  File "C:/Users/Esteban/.qgis//python/plugins\wktraster\wktRasterPlugin.py", line 90, in callAddLayer
    dlg = DlgAddRasterLayer()
  File "C:/Users/Esteban/.qgis//python/plugins\wktraster\DlgAddRasterLayer.py", line 40, in __init__
    self.updateUIMode()
  File "C:/Users/Esteban/.qgis//python/plugins\wktraster\DlgAddRasterLayer.py", line 109, in updateUIMode
    self.listTables()
  File "C:/Users/Esteban/.qgis//python/plugins\wktraster\DlgAddRasterLayer.py", line 57, in listTables
    tables=conn.listTables(self,connstring) #returns a list of pairs (index, value)
  File "C:/Users/Esteban/.qgis//python/plugins\wktraster\conn.py", line 76, in listTables
    db = GeoDB(host=parmlist[2].split("=")[1],dbname=parmlist[1].split("=")[1],user=parmlist[3].split("=")[1],passwd=parmlist[4].split("=")[1],port=int(parmlist[5].split("=")[1]))
  File "C:/Users/Esteban/.qgis//python/plugins\wktraster\postgis_utils.py", line 134, in __init__
    raise DbError(e)
  File "C:/Users/Esteban/.qgis//python/plugins\wktraster\postgis_utils.py", line 83, in __init__
    self.msg = unicode( error.args[0], 'utf-8')
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 23: invalid continuation byte

Python version:
2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]


QGIS version:
1.8.0-Lisboa Lisboa, 6416f38

Python path: ['C:/PROGRA~2/Quantum GIS Lisboa/apps/qgis/./python', 'C:/Users/Esteban/.qgis//python', 'C:/Users/Esteban/.qgis//python/plugins', 'C:/PROGRA~2/Quantum GIS Lisboa/apps/qgis/./python/plugins', 'C:\\PROGRA~2\\Quantum GIS Lisboa\\bin\\python27.zip', 'C:\\PROGRA~2\\Quantum GIS Lisboa\\apps\\Python27\\DLLs', 'C:\\PROGRA~2\\Quantum GIS Lisboa\\apps\\Python27\\lib', 'C:\\PROGRA~2\\Quantum GIS Lisboa\\apps\\Python27\\lib\\plat-win', 'C:\\PROGRA~2\\Quantum GIS Lisboa\\apps\\Python27\\lib\\lib-tk', 'C:\\PROGRA~2\\Quantum GIS Lisboa\\apps\\qgis\\bin', 'C:\\PROGRA~2\\Quantum GIS Lisboa\\apps\\Python27', 'C:\\PROGRA~2\\Quantum GIS Lisboa\\apps\\Python27\\lib\\site-packages', 'C:\\PROGRA~2\\Quantum GIS Lisboa\\apps\\Python27\\lib\\site-packages\\PIL', 'C:\\PROGRA~2\\Quantum GIS Lisboa\\apps\\Python27\\lib\\site-packages\\win32', 'C:\\PROGRA~2\\Quantum GIS Lisboa\\apps\\Python27\\lib\\site-packages\\win32\\lib', 'C:\\PROGRA~2\\Quantum GIS Lisboa\\apps\\Python27\\lib\\site-packages\\Pythonwin', 'C:\\PROGRA~2\\Quantum GIS Lisboa\\apps\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode', 'C:\\PROGRA~2\\Quantum GIS Lisboa\\apps\\qgis\\python\\plugins\\fTools\\tools']

How to solve the above problem in Lisboa version ?

Is it possible to load a PostGIS raster layer into the Dufour version ?

Best Answer

An interesting alternative is actually the DB Manager. You can try: Database > DB Manager > DB Manager. From there, navigate to the raster you want to load, and then either drag and drop it to the list of layers, or left-click and 'Add to canvas'.

More information, here.

Related Question