Skip to content
Permalink
Browse files

Allow loading pgraster tables with non-default raster field name

Before this change you could only load tables where the raster
field was named "rast".
  • Loading branch information
Sandro Santilli
Sandro Santilli committed Sep 4, 2014
1 parent e91141c commit dd788766366ed2f496cb6ef10b58313109c7a975
Showing with 11 additions and 2 deletions.
  1. +11 −2 python/plugins/db_manager/db_plugins/postgis/plugin.py
@@ -283,8 +283,17 @@ def gdalUri(self):
user = ( u'user=%s' % uri.username() ) if uri.username() else ''
passw = ( u'password=%s' % uri.password() ) if uri.password() else ''
port = ( u'port=%s' % uri.port() ) if uri.port() else ''
gdalUri = u'PG: %s %s %s %s %s mode=2 %s table=%s' % \
(dbname, host, user, passw, port, schema, self.name)

# Find first raster field
col = ''
for fld in self.fields():
if fld.dataType == "raster":
col = u'column=%s' % fld.name
break

gdalUri = u'PG: %s %s %s %s %s mode=2 %s %s table=%s' % \
(dbname, host, user, passw, port, schema, col, self.name)

return gdalUri

def mimeUri(self):

0 comments on commit dd78876

Please sign in to comment.
You can’t perform that action at this time.