Skip to content

Commit

Permalink
Simplify other_fields detection
Browse files Browse the repository at this point in the history
  • Loading branch information
dericke authored and nyalldawson committed Feb 20, 2021
1 parent ef6799f commit 97880d7
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions python/plugins/processing/algs/gdal/OneSideBuffer.py
Expand Up @@ -125,17 +125,6 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):

output, outputFormat = GdalUtils.ogrConnectionStringAndFormat(outFile, context)

other_fields = [
'"{}"'.format(f.name())
for f in fields
if f.name() != geometry
]

if other_fields:
other_fields = ',*'
else:
other_fields = ''

arguments = [
output,
ogrLayer,
Expand All @@ -144,6 +133,11 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
'-sql'
]

other_fields = ',*' if any(
f for f in fields
if f.name() != geometry
) else ''

if dissolve or fieldName:
sql = 'SELECT ST_Union(ST_SingleSidedBuffer({}, {}, {})) AS {}{} FROM "{}"'.format(geometry, distance, side, geometry, other_fields, layerName)
else:
Expand Down

0 comments on commit 97880d7

Please sign in to comment.