4

I'm new to QGIS and have the following problem: I'm trying to use the "Count points in polygons" tool, but always get an error ('NoneType' object has no attribute 'geometry' See log for more details).

Uncaught error while executing algorithm 
Traceback (most recent call last):
File 
"C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python/plugins\processing\core\GeoAlgorithm.py",line 203, in execute
self.processAlgorithm(progress)
File "C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python/plugins\algs\qgis\PointsInPolygon.py", line 91, in processAlgorithm engine = QgsGeometry.createGeometryEngine(geom.geometry())
AttributeError:'NoneType' object has no attribute 'geometry'

If I use the same points layer, but a different polygon layer, everything works fine. So there seems to be a problem with my polygon layer. Since I have no knowledge in python code, could someone please explain me, what I am doing wrong?

  • Problem solved! I found an invalid geometry in my polygon layer. – MSch Apr 12 '17 at 9:21
  • Well, it seems that you applied the @MatthiasKuhn's solution: so, please mark his answer as accepted for saying to future readers that you solved the issue in that way. – mgri Apr 12 '17 at 9:26
3

The quick fix

There are entries with NULL geometries (which is a fancy way of saying entries without geometries) in your polygon layer.

Remove those entries by using the "Remove Null Geometries" algorithm on your polygon layer.

It's also possible that there are invalid geometries on the layer, so alternatively it might be required to run an algorithm like v.clean to fix invalid geometries.

The long term solution

However, getting those messages is not a good thing. So if you want to help improving QGIS in a sustainable way, please check if this issue is still present in QGIS master (by installing 2.99) and file an issue if it's not already there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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