I am using Quantum GIS and trying to spatially join a point grid with polygons that are overlapping. If I get the sum of intersecting features, then I can get a good raster value. Well, every time I attempt the spatial joing with the summary, I get the following python error:

An error has occured while executing Python code:

Traceback (most recent call last): File "/usr/share/qgis/python/plugins/fTools/tools/doSpatialJoin.py", line 99, in accept res = self.compute(inName, joinName, outPath, summary, sumList, keep, self.progressBar) File "/usr/share/qgis/python/plugins/fTools/tools/doSpatialJoin.py", line 214, in compute if k == "SUM": atMap.append(sum(numFields[j])) TypeError: unsupported operand type(s) for +: 'int' and 'QPyNullVariant'

Python version: 2.7.4 (default, Sep 26 2013, 03:23:21) [GCC 4.7.3

Any idea why I may be getting this error? I am trying to join 65,527 points to 121 polygons in this case.

Thanks for the help!

1 Answer 1


This has nothing to do with the amount of data.

This is an error caused by NULL values in your data.

This should be considered a bug. Please open a ticket for this.]

This has been fixed in commit f9e0093. Unfortunately just a bit too late to hit QGIS 2.2.0. It would be very nice if you could test this fix (e.g. with tomorrow's master build) and give a feedback here.

As a workaround (for QGIS <= 2.2.0), one can (temporarily) replace NULL values with 0 if the only value of interest is the sum (will/may obviously lead to wrong results for other aggregates like min/max/avg/median)

  • I had been running from the 2.0.x binary, but I'm working on building from source now. I'll update with my results if I ever get the make to work properly... running into issues with python2.7
    – jpmaniac87
    Commented Feb 27, 2014 at 18:52
  • If it's only for this fix: There are master/testing/nightly (all refer to the same) builds around for all major platforms. You may as well just replace the file /usr/share/qgis/python/plugins/fTools/tools/doSpatialJoin.py on your system with the one from git Commented Feb 28, 2014 at 7:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.