Skip to content
Permalink
Browse files

Merge pull request #2332 from NaturalGIS/fix_ogr_tools

[processing] fix some OGR-based tools
  • Loading branch information
alexbruy committed Sep 27, 2015
2 parents 4dd6d67 + 9cb18c6 commit bdb8b0cec929f2ade6f60bf2805adbbd04dc3b18
@@ -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
@@ -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])
@@ -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
@@ -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')
@@ -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:
@@ -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
@@ -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 + '"'
@@ -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)
@@ -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:
@@ -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])
@@ -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
@@ -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 + '"'
@@ -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)
@@ -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:
@@ -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])

0 comments on commit bdb8b0c

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