Skip to content

Commit

Permalink
remove usless options form ogr offset line tool
Browse files Browse the repository at this point in the history
  • Loading branch information
gioman committed Feb 10, 2017
1 parent 16384cf commit 5ade65a
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions python/plugins/processing/algs/gdal/offsetcurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ class OffsetCurve(GdalAlgorithm):
INPUT_LAYER = 'INPUT_LAYER'
GEOMETRY = 'GEOMETRY'
RADIUS = 'RADIUS'
DISSOLVEALL = 'DISSOLVEALL'
FIELD = 'FIELD'
MULTI = 'MULTI'
OPTIONS = 'OPTIONS'

def defineCharacteristics(self):
Expand All @@ -65,12 +62,6 @@ def defineCharacteristics(self):
self.tr('Offset distance (positive value for left-sided and negative - for right-sided)'),
-99999999.999999, 99999999.999999, 1000.0,
optional=False))
self.addParameter(ParameterBoolean(self.DISSOLVEALL,
self.tr('Dissolve all results'), False))
self.addParameter(ParameterTableField(self.FIELD,
self.tr('Dissolve by attribute'), self.INPUT_LAYER, optional=True))
self.addParameter(ParameterBoolean(self.MULTI,
self.tr('Output as singlepart geometries (only used when dissolving by attribute)'), False))
self.addParameter(ParameterString(self.OPTIONS,
self.tr('Additional creation options (see ogr2ogr manual)'),
'', optional=True))
Expand All @@ -81,9 +72,6 @@ def getConsoleCommands(self):
inLayer = self.getParameterValue(self.INPUT_LAYER)
geometry = self.getParameterValue(self.GEOMETRY)
distance = self.getParameterValue(self.RADIUS)
dissolveall = self.getParameterValue(self.DISSOLVEALL)
field = self.getParameterValue(self.FIELD)
multi = self.getParameterValue(self.MULTI)
options = self.getParameterValue(self.OPTIONS)

ogrLayer = ogrConnectionString(inLayer)[1:-1]
Expand All @@ -102,19 +90,10 @@ def getConsoleCommands(self):
arguments.append('sqlite')
arguments.append('-sql')

if dissolveall or field is not None:
sql = "SELECT ST_Union(ST_OffsetCurve({}, {})) * FROM '{}'".format(geometry, distance, layername)
else:
sql = "SELECT ST_OffsetCurve({}, {}), * FROM '{}'".format(geometry, distance, layername)

if field is not None:
sql = '"{} GROUP BY {}"'.format(sql, field)
sql = "SELECT ST_OffsetCurve({}, {}), * FROM '{}'".format(geometry, distance, layername)

arguments.append(sql)

if field is not None and multi:
arguments.append('-explodecollections')

if options is not None and len(options.strip()) > 0:
arguments.append(options)

Expand Down

0 comments on commit 5ade65a

Please sign in to comment.