11

I am trying to create a Voronoi Diagram on a specific polygon, but there is some issue when dealing with edges. Here is how I do it:

  1. Preparing the points for Voronoi and the polygon for the diagram points for Voronoi and the customized area

  2. Create Vornoi enter image description here

  3. Cut the edge using the polygon enter image description here

  4. Combine the cut Voronoi and the polygon using Union (not sure if this is the best way) And here comes my problem for the edges. I would like to: 1) remove the frame from original Voronoi map (marked in blue) 2) extend the edges to the edge of the area polygon(marked in red), so that the service area at the edge side will be realistic. enter image description here

How can I do this?

3 Answers 3

12

You can use the v.voronoi tool from GRASS to create voronoi polygons, and it will enables you to specify an extent based on layer extent:

enter image description here

3
  • Hi @ahmadhanb, how can I use this function in QGIS? I didn't see it in the plugins. Do I have to set up anything before using it? Thanks!
    – Pete
    May 8, 2019 at 3:27
  • 1
    @Pete You can find the tool from Processing Toolbox -> GRASS -> Vector -> v.voronoi
    – ahmadhanb
    May 8, 2019 at 5:08
  • This is perfect!
    – Pete
    May 8, 2019 at 6:37
11

You can do this simply, by adjusting the buffer.

Here is an example. The following polygon and points layers would normally result in the problem you illustrate in your question.

irregular polygon with random points

  1. When running the Voronoi polygons tool, increase the buffer region percent. The exact amount will vary, but since we're clipping the result, it won't hurt to overshoot. In my example, I use a buffer of 100% to double the extent.

Here is the output. My 100% buffer actually extends well beyond this image.

voronoi polygons overlaid on input layers

  1. Clip the Voronoi polygons by the original polygon layer.

clipped voronoi polygons

And there you have it!

1
  • Nice technique. Thank you. Oct 31, 2021 at 1:06
5

In order to show you the variety of ways to solve your problem, only with the help of QGIS I will provide another way: initial data are presented in the screenshot below enter image description here

1) Since your shape has a complex shape, run the “Vector> Geoprocessing> Buffer Zones” buffer onto it and extract the “Vector> Geometry processing> Eject nodes” points, see the figure below enter image description here

2) Copy the points from the source layer “Pencil> Edit> Copy Objects” to the buffer points and run on them polygons Voronoi “Vector> Geometry Processing> Voronoi Polygons ...”, see the figure below enter image description here

3) Cut the polygons with your original shape using "Vector> Geoprocessing> Trimming" and see the result ... enter image description here

I wish you success…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.