TransWikia.com

Calculating Voronoi Diagrams for polygons

Geographic Information Systems Asked by AJSmyth on January 13, 2021

There are a variety of good algorithms for generating the Voronoi polygons or their complement, the Delaunay Triangulation for a set of points.

My question is simply, is there an algorithm for generating the Voronoi diagram for a set of input polygons, rather than points?

One technique I’ve explored is breaking my polygons into sets of vertices, and creating the Voronoi diagrams for those, then combining the resulting shapes for each set of vertices belonging to a particular input polygon. The results are not totally accurate, however. Does anyone have an alternate technique?

EDIT:

Here is a super rough hand-drawn example of what I’m after. I have a set of polygons with gaps. I’m trying to create output polygons with no gaps between them. Ultimately I want to use this to say whether any two nearby polygons can be considered “adjacent” to one another, even if they are not touching.

Super rough example

5 Answers

I like the answer which mentioned "Segment Voronoi diagrams," but I ultimately found it difficult to implement in my particular workflow. I found that because my geometries were fairly detailed (i.e., they had a large number of vertices compared to their area) I was able to calculate the voronoi diagram for the vertices of all input polygons using ST_VoronoiPolygons in PostGIS. Then I intersected those voronoi polygons with the input geometries and unioned them accordingly. The resulting polygons were good enough to tell me which polygons were adjacent (that is, it was possible to cast a ray from at least some point on Polygon A to Polygon B without hitting any Polygon C) without the polygons actually touching. This method obviously has some limitations; if your geometries are not detailed enough, the results will be less accurate. In my case, it was good enough.

Correct answer by AJSmyth on January 13, 2021

You may search publications about "Segment Voronoi Diagram" or perhaps also "Medial Axis". CGAL offers Segment Voronoi Diagrams.

Answered by Geom on January 13, 2021

Do you have to use Voronoi tesselation, or are you simply looking for a means to fill the gaps between polygons? Are you working with a particular GIS suite? I ask because you might use something like Euclidean Allocation in ArcGIS to get at a suitable result. The tool outputs a raster, but that could be converted back to polygons if required.

Answered by Jae on January 13, 2021

The easiest way I found is using PostGIS to create buffers and then use use ST_ApproximateMedialAxis. It is (slightly) approximate but it does work really well in the vast majority of cases. It allows much better results than using buffer and then use the centroid of the polygons to generate a Voronoi Diagram to clip it with.

In practice, the buffer size needs to be large enough so the generated buffers overlap each other. Then ST_Union will dissolve the buffers, you then cut the resulting dissolved buffer layer by clipping it with the original one. The result is a large dissolved buffer with holes. It's this buffer that needs to be processed by ST_ApproximateMedialAxis.

Finally, the polygons that do not touch the original ones need to be deleted with ST_Touches, which is also very good to grab attributes of the original set of polygons:

enter image description here

ST_VoronoiPolygons doesn't produce the expected result in my situation: enter image description here

Answered by Leo on January 13, 2021

I posted a mini python package to make it - voronoi-diagram-for-polygons. It should be pointed out in advance that this package depends on v1.8.dev0 of shapely which is still in development. In other words, it cannot be installed by pip automatically. You have to install it by the following:

pip install git+https://github.com/Toblerity/Shapely.

inputoutput

Answered by Bruce Xiaolong Liu on January 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP