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 667ba4255e87e8e05051e7fa8b4851633b3da4b7
Showing with 8 additions and 8 deletions.
  1. +8 −8 python/plugins/processing/algs/qgis/MeanCoords.py
@@ -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.
You can’t perform that action at this time.