Skip to content

Commit

Permalink
[processing] Use null instead of nan for invalid stat values in join …
Browse files Browse the repository at this point in the history
…by location summary
  • Loading branch information
nyalldawson committed Apr 2, 2019
1 parent 9eb30db commit 6800b3d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/plugins/processing/algs/qgis/SpatialJoinSummary.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
__revision__ = '$Format:%H$' __revision__ = '$Format:%H$'


import os import os
import math


from collections import defaultdict from collections import defaultdict


Expand Down Expand Up @@ -339,7 +340,8 @@ def addField(original, stat, type):
stat.finalize() stat.finalize()
for s in numeric_fields: for s in numeric_fields:
if s[0] in summaries: if s[0] in summaries:
attrs.append(getattr(stat, s[2])()) val = getattr(stat, s[2])()
attrs.append(val if not math.isnan(val) else NULL)
elif field_type == 'datetime': elif field_type == 'datetime':
stat = QgsDateTimeStatisticalSummary() stat = QgsDateTimeStatisticalSummary()
stat.calculate(attribute_values) stat.calculate(attribute_values)
Expand Down

0 comments on commit 6800b3d

Please sign in to comment.