Skip to content
Permalink
Browse files

Simplify other_fields detection

  • Loading branch information
dericke authored and nyalldawson committed Feb 20, 2021
1 parent ef6799f commit 97880d74d5aa2e21a437924497728ad7552947bc
Showing with 5 additions and 11 deletions.
  1. +5 −11 python/plugins/processing/algs/gdal/OneSideBuffer.py
@@ -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,
@@ -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:

0 comments on commit 97880d7

Please sign in to comment.