Calculating Voronoi Diagrams for polygons

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


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


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.