3

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?

asked Apr 11, 2013 at 22:32
5
  • 1
    this code may help you github.com/qgis/Quantum-GIS/blob/master/python/plugins/fTools/… Commented Apr 11, 2013 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? Commented Apr 12, 2013 at 0:28
  • sorry i have never used this script, i've found it just by googling for you. Commented Apr 12, 2013 at 0:32
  • Oh alright, thanks for the help. I'll tinker with it see if there is a way to make it work. Commented Apr 12, 2013 at 0:40
  • cant you use the processing tool? i.e. grass:v.voronoi and qgis:voronoipolygons Commented Oct 1, 2013 at 15:32

1 Answer 1

2

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")
answered Mar 18, 2014 at 1:43

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.