Skip to content

Commit

Permalink
[processing] correctly handle null gems in meancoords alg
Browse files Browse the repository at this point in the history
Fixes #17026
  • Loading branch information
volaya committed Aug 22, 2017
1 parent 7ca8de9 commit 667ba42
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions python/plugins/processing/algs/qgis/MeanCoords.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ def processAlgorithm(self, progress):
current = 0
total = 100.0 / len(means)
for (clazz, values) in means.iteritems():
outFeat = QgsFeature()
cx = values[0] / values[2]
cy = values[1] / values[2]
meanPoint = QgsPoint(cx, cy)

outFeat.setGeometry(QgsGeometry.fromPoint(meanPoint))
outFeat.setAttributes([cx, cy, clazz])
writer.addFeature(outFeat)
if values[2]:
outFeat = QgsFeature()
cx = values[0] / values[2]
cy = values[1] / values[2]
meanPoint = QgsPoint(cx, cy)
outFeat.setGeometry(QgsGeometry.fromPoint(meanPoint))
outFeat.setAttributes([cx, cy, clazz])
writer.addFeature(outFeat)
current += 1
progress.setPercentage(int(current * total))

Expand Down

0 comments on commit 667ba42

Please sign in to comment.