Bug report #17026

Error for Mean coordinate(s) when geometry is NULL

Added by Loïc BARTOLETTI over 6 years ago. Updated over 6 years ago.

Assignee:Victor Olaya
Affected QGIS version:2.18.11 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:24925



A little error when you try to use MeanCoords algorithm with a layer which contain NULL geometry.

The solution is to clean this layer or add maybe add a test on geometry before run the algorithm.

2017-08-17T11:22:48 2 Uncaught error while executing algorithm
Traceback (most recent call last):
File "C:/Users/da14/.qgis2/python/plugins\processing\core\GeoAlgorithm.py", line 230, in execute
File "C:/Users/da14/.qgis2/python/plugins\processing\algs\qgis\MeanCoords.py", line 116, in processAlgorithm
cx = values[0] / values[2]
ZeroDivisionError: integer division or modulo by zero

You can reproduce it with a testdata (shp_with_null_geometry_extract.shp) and run the algorithm with Unique ID field set to "HubName".
The Null geometries have HubName set to Null.

Tested with QGis 2.14.17, 2.18.11 and master.

Thank you.

MeanCoords_error.zip (5.52 KB) Loïc BARTOLETTI, 2017-08-17 11:51 AM

Associated revisions

Revision 667ba425
Added by Victor Olaya over 6 years ago

[processing] correctly handle null gems in meancoords alg

Fixes #17026


#1 Updated by Giovanni Manghi over 6 years ago

  • Affected QGIS version changed from 2.14.0 to 2.18.11

#2 Updated by Victor Olaya over 6 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Also available in: Atom PDF