Skip to content
Permalink
Browse files
[processing] correctly handle null gems in meancoords alg
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.
@@ -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))

0 comments on commit 667ba42

Please sign in to comment.