Skip to content
Permalink
Browse files

[processing] warn user about incorrect input data when calculating

mean coordinates using weight field (fix #9084)
  • Loading branch information
alexbruy committed Feb 7, 2017
1 parent 9bd0d7a commit 4963548f4db0789401076377269368c4f8df8ec1
Showing with 5 additions and 0 deletions.
  1. +5 −0 python/plugins/processing/algs/qgis/MeanCoords.py
@@ -34,6 +34,7 @@
from qgis.core import Qgis, QgsField, QgsFeature, QgsGeometry, QgsPoint, QgsWkbTypes

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from processing.core.parameters import ParameterTableField
from processing.core.parameters import ParameterVector
from processing.core.outputs import OutputVector
@@ -110,6 +111,10 @@ def processAlgorithm(self, feedback):
weight = float(feat.attributes()[weightIndex])
except:
weight = 1.00

if weight < 0:
raise GeoAlgorithmExecutionException(self.tr('Negative weight value found. Please fix you data and try again.'))

This comment has been minimized.

Copy link
@DelazJ

DelazJ Feb 7, 2017

Contributor

typo: your data


if clazz not in means:
means[clazz] = (0, 0, 0)

0 comments on commit 4963548

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