Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 committed Sep 4, 2014
1 parent e91141c commit dd78876
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions python/plugins/db_manager/db_plugins/postgis/plugin.py
Expand Up @@ -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):
Expand Down

0 comments on commit dd78876

Please sign in to comment.