I want to run the process "qgis:intersection" in a pyton-script and try it like this:
import processing
a1 = QgsMapLayerRegistry.instance().mapLayersByName('Layer1')[0]
a2 = QgsMapLayerRegistry.instance().mapLayersByName('Layer2')[0]
processing.runandload("qgis:intersection", a1, a2, "memory:myCut")
But there comes the "Problem executing algorithm" message: "GEOS geoprocessing error: One or more input features have invalid geometry."
If i do the same by the qgis-gui (Vector/Geoprocessing Tools/Intersect...) in QGIS 2.14.21 like this:
then everything is ok and qgis do the intersection.
Doing the intersectin with QGIS 2.18.13 with the gui, I become also an error like above.
"Layer2" is a large layer with some hundredthousands polygons an if i use the "Topology Checker" i get about 600 invalid geometries.
Why does the intersection work only with the qgis-gui in 2.14.21 and not somewhere else?
Ignore NULL geometries
setting which you could use when you run your script and see if it works:processing.runandload("qgis:intersection", a1, a2, True, "memory:myCut")