Make argument setting consistent

This commit is contained in:
Evan Derickson 2021-02-14 14:18:16 -08:00 committed by Nyall Dawson
parent 5302feb2dd
commit 0a3b7d36f8

View File

@ -125,6 +125,13 @@ class OneSideBuffer(GdalAlgorithm):
output, outputFormat = GdalUtils.ogrConnectionStringAndFormat(outFile, context) output, outputFormat = GdalUtils.ogrConnectionStringAndFormat(outFile, context)
other_fields_exist = any(
True for f in fields
if f.name() != geometry
)
other_fields = ',*' if other_fields_exist else ''
arguments = [ arguments = [
output, output,
ogrLayer, ogrLayer,
@ -133,13 +140,6 @@ class OneSideBuffer(GdalAlgorithm):
'-sql' '-sql'
] ]
other_fields_exist = any(
True for f in fields
if f.name() != geometry
)
other_fields = ',*' if other_fields_exist else ''
if dissolve or fieldName: if dissolve or fieldName:
sql = 'SELECT ST_Union(ST_SingleSidedBuffer({}, {}, {})) AS {}{} FROM "{}"'.format(geometry, distance, side, geometry, other_fields, layerName) sql = 'SELECT ST_Union(ST_SingleSidedBuffer({}, {}, {})) AS {}{} FROM "{}"'.format(geometry, distance, side, geometry, other_fields, layerName)
else: else: