Skip to content
Permalink
Browse files

Simplify other_field checker

  • Loading branch information
dericke authored and nyalldawson committed Feb 20, 2021
1 parent 97880d7 commit 26ad7c6a468139087bf73081cb4b2f7ecfdf5204
@@ -114,24 +114,14 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):

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

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

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

arguments = []
arguments.append(output)
arguments.append(ogrLayer)
arguments.append('-dialect')
arguments.append('sqlite')
arguments.append('-sql')
other_fields = ',*' if other_fields_exist else ''

arguments = [output, ogrLayer, '-dialect', 'sqlite', '-sql']
if dissolve or fieldName:
sql = 'SELECT ST_Union(ST_Buffer({}, {})) AS {}{} FROM "{}"'.format(geometry, distance, geometry, other_fields, layerName)
else:
@@ -124,17 +124,12 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):

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

other_fields = []
for f in fields:
if f.name() == geometry:
continue
other_fields_exist = any(
True for f in fields
if f.name() != geometry
)

other_fields.append('"{}"'.format(f.name()))

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

arguments = [
output,
@@ -96,16 +96,12 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):

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

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

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

other_fields = ',*' if other_fields_exist else ''

arguments = [
output,
@@ -100,13 +100,13 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):

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

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

other_fields = ',*' if other_fields_exist else ''

other_fields = ',*' if other_fields else ''
arguments = [
output,
ogrLayer,

0 comments on commit 26ad7c6

Please sign in to comment.