Skip to content

Commit

Permalink
fix some processing/ogr tools
Browse files Browse the repository at this point in the history
  • Loading branch information
Giovanni Manghi committed Sep 22, 2015
1 parent 6a6adc9 commit 9cb18c6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
3 changes: 1 addition & 2 deletions python/plugins/processing/algs/gdal/ogr2ogrclipextent.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def getConsoleCommands(self):
inLayer = self.getParameterValue(self.INPUT_LAYER)
ogrLayer = self.ogrConnectionString(inLayer)[1:-1]
clipExtent = self.getParameterValue(self.CLIP_EXTENT)
ogrclipExtent = self.ogrConnectionString(clipExtent)

output = self.getOutputFromName(self.OUTPUT_LAYER)
outFile = output.value
Expand All @@ -69,7 +68,7 @@ def getConsoleCommands(self):
options = unicode(self.getParameterValue(self.OPTIONS))

arguments = []
regionCoords = ogrclipExtent.split(',')
regionCoords = clipExtent.split(',')
arguments.append('-spat')
arguments.append(regionCoords[0])
arguments.append(regionCoords[2])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ def getConsoleCommands(self):
inLayer = self.getParameterValue(self.INPUT_LAYER)
ogrLayer = self.ogrConnectionString(inLayer)[1:-1]
schema = unicode(self.getParameterValue(self.SCHEMA))
schemastring = "-lco SCHEMA=" + schema
table = unicode(self.getParameterValue(self.TABLE))
pk = unicode(self.getParameterValue(self.PK))
pkstring = "-lco FID=" + pk
Expand Down Expand Up @@ -153,6 +152,10 @@ def getConsoleCommands(self):
arguments.append('dbname=' + dbname)
if len(password) > 0:
arguments.append('password=' + password)
if len(schema) > 0:
arguments.append('active_schema=' + schema)
else:
arguments.append('active_schema=public')
arguments.append('user=' + user + '"')
arguments.append(ogrLayer)
arguments.append('-nlt NONE')
Expand All @@ -165,8 +168,6 @@ def getConsoleCommands(self):
arguments.append('-addfields')
if overwrite:
arguments.append('-overwrite')
if len(schema) > 0:
arguments.append(schemastring)
if len(pk) > 0:
arguments.append(pkstring)
elif primary_key is not None:
Expand Down
10 changes: 5 additions & 5 deletions python/plugins/processing/algs/gdal/ogr2ogrtopostgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ def getConsoleCommands(self):
dbname = unicode(self.getParameterValue(self.DBNAME))
password = unicode(self.getParameterValue(self.PASSWORD))
schema = unicode(self.getParameterValue(self.SCHEMA))
schemastring = "-lco SCHEMA=" + schema
table = unicode(self.getParameterValue(self.TABLE))
pk = unicode(self.getParameterValue(self.PK))
pkstring = "-lco FID=" + pk
Expand All @@ -173,7 +172,6 @@ def getConsoleCommands(self):
simplify = unicode(self.getParameterValue(self.SIMPLIFY))
segmentize = unicode(self.getParameterValue(self.SEGMENTIZE))
spat = self.getParameterValue(self.SPAT)
ogrspat = self.ogrConnectionString(spat)
clip = self.getParameterValue(self.CLIP)
where = unicode(self.getParameterValue(self.WHERE))
wherestring = '-where "' + where + '"'
Expand Down Expand Up @@ -201,6 +199,10 @@ def getConsoleCommands(self):
arguments.append('dbname=' + dbname)
if len(password) > 0:
arguments.append('password=' + password)
if len(schema) > 0:
arguments.append('active_schema=' + schema)
else:
arguments.append('active_schema=public')
arguments.append('user=' + user + '"')
arguments.append(dimstring)
arguments.append(ogrLayer)
Expand All @@ -218,8 +220,6 @@ def getConsoleCommands(self):
if len(self.GEOMTYPE[self.getParameterValue(self.GTYPE)]) > 0:
arguments.append('-nlt')
arguments.append(self.GEOMTYPE[self.getParameterValue(self.GTYPE)])
if len(schema) > 0:
arguments.append(schemastring)
if len(geocolumn) > 0:
arguments.append(geocolumnstring)
if len(pk) > 0:
Expand All @@ -239,7 +239,7 @@ def getConsoleCommands(self):
arguments.append('-a_srs')
arguments.append(asrs)
if len(spat) > 0:
regionCoords = ogrspat.split(',')
regionCoords = spat.split(',')
arguments.append('-spat')
arguments.append(regionCoords[0])
arguments.append(regionCoords[2])
Expand Down
10 changes: 5 additions & 5 deletions python/plugins/processing/algs/gdal/ogr2ogrtopostgislist.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ def getConsoleCommands(self):
tsrs = unicode(self.getParameterValue(self.T_SRS))
asrs = unicode(self.getParameterValue(self.A_SRS))
schema = unicode(self.getParameterValue(self.SCHEMA))
schemastring = "-lco SCHEMA=" + schema
table = unicode(self.getParameterValue(self.TABLE))
pk = unicode(self.getParameterValue(self.PK))
pkstring = "-lco FID=" + pk
Expand All @@ -179,7 +178,6 @@ def getConsoleCommands(self):
simplify = unicode(self.getParameterValue(self.SIMPLIFY))
segmentize = unicode(self.getParameterValue(self.SEGMENTIZE))
spat = self.getParameterValue(self.SPAT)
ogrspat = self.ogrConnectionString(spat)
clip = self.getParameterValue(self.CLIP)
where = unicode(self.getParameterValue(self.WHERE))
wherestring = '-where "' + where + '"'
Expand Down Expand Up @@ -207,6 +205,10 @@ def getConsoleCommands(self):
arguments.append('dbname=' + dbname)
if len(password) > 0:
arguments.append('password=' + password)
if len(schema) > 0:
arguments.append('active_schema=' + schema)
else:
arguments.append('active_schema=public')
arguments.append('user=' + user + '"')
arguments.append(dimstring)
arguments.append(ogrLayer)
Expand All @@ -224,8 +226,6 @@ def getConsoleCommands(self):
if len(self.GEOMTYPE[self.getParameterValue(self.GTYPE)]) > 0:
arguments.append('-nlt')
arguments.append(self.GEOMTYPE[self.getParameterValue(self.GTYPE)])
if len(schema) > 0:
arguments.append(schemastring)
if len(geocolumn) > 0:
arguments.append(geocolumnstring)
if len(pk) > 0:
Expand All @@ -245,7 +245,7 @@ def getConsoleCommands(self):
arguments.append('-a_srs')
arguments.append(asrs)
if len(spat) > 0:
regionCoords = ogrspat.split(',')
regionCoords = spat.split(',')
arguments.append('-spat')
arguments.append(regionCoords[0])
arguments.append(regionCoords[2])
Expand Down

0 comments on commit 9cb18c6

Please sign in to comment.