The following python commands both appear to function when called in qgis 2.6 to generate Voronoi diagrams:
processing.runalg("qgis:voronoipolygons", pointLayer, 1, None)
processing.runalg("grass:v.voronoi",pointLayer,False,False, bbox,-1,0.0001,0, None)
but neither of them seems to work well. The first (qgis) is extremely slow, taking 38 seconds with 180 points vs 2 seconds for the grass method. The qgis method also seems to ignore the output variable when it is specified ("C:/tmp/output.shp" in place of None), but the output layer does appear in the Layers pane so I can iterate through the layers and find it.
The second algorithm seems to ignore the output parameter (again, "C:/tmp/output.shp" in place of None), and no result seems to appear in the layer pane. Trying to use memory:name generated an error message. However, the following results in a temp file path being returned:
output = processing.runalg("grass:v.voronoi",PointLayer,False,False, bbox,-1,0.0001,0, None)
print output.output
My datasets will have thousands of points, so the qgis library is much too slow and the grass library requires a workaround to get the result out.
Is there a way to make qgis:voronoipolygons run faster? Is there a syntax I am missing to get the result layer from the algorithm? It will be an intermediate result used for future calculations so memory storage is preferred.
processing.runandloadinstead ofprocessing.runalg. This should load the result layers from memory. – Joseph Jan 27 '15 at 12:29output_1=processing.runalg(.... Then when you call your second command, you can reference the output layer from the first command by usingoutput_1as the input layer. – Joseph Jan 27 '15 at 16:27I would prefer to set my own temp location, or specify the file name, or receive the result in memory as an already-instantiated QgsVectorLayer or similar.
– user15741 Jan 27 '15 at 16:50