Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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 4963548
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/plugins/processing/algs/qgis/MeanCoords.py
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 4963548

Please sign in to comment.