Skip to content

Commit

Permalink
[processing] Some fixes to handling of uppercase/lowercase geometry c…
Browse files Browse the repository at this point in the history
…olumn names
  • Loading branch information
nyalldawson committed May 20, 2014
1 parent ed076d0 commit ec3da40
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions python/plugins/processing/algs/admintools/ImportIntoPostGIS.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,22 @@ def processAlgorithm(self, progress):
if not geomColumn:
geomColumn = 'the_geom'

uri = QgsDataSourceURI()
uri.setConnection(host, str(port), database, username, password)
if primaryKeyField:
uri.setDataSource(schema, table, geomColumn, '', primaryKeyField)
else:
uri.setDataSource(schema, table, geomColumn, '')

options = {}
if overwrite:
options['overwrite'] = True
if convertLowerCase:
options['lowercaseFieldNames'] = True
geomColumn = geomColumn.lower()
if dropStringLength:
options['dropStringConstraints'] = True

uri = QgsDataSourceURI()
uri.setConnection(host, str(port), database, username, password)
if primaryKeyField:
uri.setDataSource(schema, table, geomColumn, '', primaryKeyField)
else:
uri.setDataSource(schema, table, geomColumn, '')

layerUri = self.getParameterValue(self.INPUT)
layer = dataobjects.getObjectFromUri(layerUri)
(ret, errMsg) = QgsVectorLayerImport.importLayer(
Expand Down

0 comments on commit ec3da40

Please sign in to comment.