I've been looking to see if there was a way to call Voronoi Polygons function found in Vector/Geometry Tools, directly from the code but I have not found one. Does this currently exist? Is there a way to call these functions within python coding?
-
1this code may help you github.com/qgis/Quantum-GIS/blob/master/python/plugins/fTools/… – geogeek Apr 11 '13 at 22:59
-
Hmm, the code does offer some insight. However, what needs to be imported so the in-built functions like computeVoronoiDiagram() can be used? – NothingToSay Apr 12 '13 at 0:28
-
sorry i have never used this script, i've found it just by googling for you. – geogeek Apr 12 '13 at 0:32
-
Oh alright, thanks for the help. I'll tinker with it see if there is a way to make it work. – NothingToSay Apr 12 '13 at 0:40
-
cant you use the processing tool? i.e. grass:v.voronoi and qgis:voronoipolygons – BJEBN Oct 1 '13 at 15:32
BJEBN has suggested a function from the processing toolbox. Here's how to use it: As per http://qgis.org/de/docs/user_manual/processing/console.html
From the console you can get a list of all the algorithms available which contain the word "Voronoi" by typing:
import processing
processing.alglist("Voronoi")
Then you could find out how to use what appears the most appropriate function with:
processing.alghelp("qgis:voronoipolygons")
Then simply use the algorithm in your script as follows:
processing.runalg("qgis:voronoipolygons",inputlayer,"output_file.shp")