Skip to content
Permalink
Browse files

Initialise writer after appending field

  • Loading branch information
rudivs committed Sep 13, 2018
1 parent 6257cf6 commit cef34c5e517ccbd737285095f0a5e4606ee11aaf
Showing with 13 additions and 7 deletions.
  1. +13 −7 python/plugins/processing/algs/qgis/KNearestConcaveHull.py
@@ -108,13 +108,6 @@ def processAlgorithm(self, parameters, context, feedback):
fields = QgsFields()
fields.append(QgsField('id', QVariant.Int, '', 20))

# Initialize writer
(sink, dest_id) = self.parameterAsSink(parameters, self.OUTPUT, context,
fields, QgsWkbTypes.Polygon, source.sourceCrs())

if sink is None:
raise QgsProcessingException(self.invalidSinkError(parameters, self.OUTPUT))

current = 0

# Get properties of the field the grouping is based on
@@ -123,6 +116,12 @@ def processAlgorithm(self, parameters, context, feedback):
if field_index >= 0:
fields.append(source.fields()[field_index]) # Add a field with the name of the grouping field

# Initialize writer
(sink, dest_id) = self.parameterAsSink(parameters, self.OUTPUT, context,
fields, QgsWkbTypes.Polygon, source.sourceCrs())
if sink is None:
raise QgsProcessingException(self.invalidSinkError(parameters, self.OUTPUT))

success = False
fid = 0

@@ -166,6 +165,13 @@ def processAlgorithm(self, parameters, context, feedback):

else:
# Not grouped by field

# Initialize writer
(sink, dest_id) = self.parameterAsSink(parameters, self.OUTPUT, context,
fields, QgsWkbTypes.Polygon, source.sourceCrs())
if sink is None:
raise QgsProcessingException(self.invalidSinkError(parameters, self.OUTPUT))

points = []
request = QgsFeatureRequest()
request.setSubsetOfAttributes([])

0 comments on commit cef34c5

Please sign in to comment.
You can’t perform that action at this time.