I asked a question several days ago about creating an in-memory layer using the processing.runalg() command in a standalone PyQGIS application (Performing in-memory difference operation between vector layers in PyQGIS). The solution seems to work perfectly well in the QGIS Python console, but not when I try it in a standalone application.
The relevant snippet of code I am running is:
diffp = processing.runalg("qgis:fixeddistancebuffer", layer, 0.000001, 10, False, None) diff = processing.getObject(diffp['OUTPUT'])
(layer is a vector layer defining line segments)
My desired output is this, and this is what I get when I run the commands from the Python console in QGIS:
But what I get from the vector layer I create in the standalone application is shown in green in the following image (I've zoomed in so that it's visible):
What I get from the standalone application appears to be only one feature from my desired output. I'm running the same two lines of code for both the console and standalone applications, and there are no exceptions thrown by the code. How can I produce the entire desired result from a standalone application, rather than just a single feature?
I've tried using the following line of code to directly create a .shp file, in case the in-memory layer was somehow causing the problem:
diffp = general.runalg("qgis:fixeddistancebuffer", layer, 0.000001, 10, False, "shape_file.shp")
This produces the same results as when I use the in-memory layer, so the problem I'm experiencing is definitely coming from runalg().