I had recently removed QGIS 2.14 and then I installed QGIS 2.18 through OSGeo installer. Since then I have noticed problems with the function Join by Attributes in QGIS standalone script. Despite the fact all features in the input layer should be present in the output layer, the output layer is incomplete. It means that the output layer contains always only 1 feature. I tested that function on different data including the layers that had worked fine with installed QGIS 2.14. There are not any error notifications though. The code is as follows:
# -*- coding: utf-8 -*- from qgis.core import * from qgis.utils import * import os, sys QgsApplication.setPrefixPath("C:/OSGeo4W64/apps/qgis", True) app = QApplication(, True) QgsApplication.initQgis() sys.path.append('C:/OSGEO4~1/apps/qgis/python/plugins') from processing.core.Processing import Processing from processing.tools import * Processing.initialize() layer1 = "D:\\point_shapefile.shp" layer2 = "D:\\polygon_shapefile.shp" result = "D:\\output_shapefile.shp" general.runalg("qgis:joinattributesbylocation", layer1, layer2, u'intersects', 0, 0, '', 1, result)
Although it works as a charm, if I run a script in a QGIS window with the same data:
import processing layer1 = "D:\\point_shapefile.shp" layer2 = "D:\\polygon_shapefile.shp" result = "D:\\output_shapefile.shp" processing.runalg("qgis:joinattributesbylocation",layer1,layer2,u'intersects',0,0,"",1,result)
How could I resolve the problem with incomplete output layer from QGIS standalone script?
I would like to avoid downgrading to QGIS 2.14.
I decided to report that issue on the site