Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Simplify other_field checker
- Loading branch information
|
@@ -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, |
|
|