My question is quite related to the unanswered Split overlap between polygons into disjoint sets except I'm not using
shapely, I'm using PostGIS 2.4 on PostgreSQL 10.
I have a table containing multipolygons for administrative units. The geometries only cover land area. My goal is to extend them a given distance into the water.
To extend the current polygons into the water, I do a buffer followed by subtracting all other geometries in the table. This clips the buffer where the geometry has neighbours and retains the buffer where the layer currently has nothing. So, something like:
SELECT c1.name , ST_Difference( ST_Buffer( ST_Union(c1.geom), 250 ) , (SELECT ST_Union(c2.geom) FROM foo.county AS c2 WHERE c2.name <> c1.name) ) FROM foo.county AS c1 GROUP BY c1.name;
However, this of course gives me overlapping buffers where two polygons meet each other at the water's edge, as well as across narrow straits:
(Note that the small purple sliver on the left should be completely assigned to the red polygon, as no point in that geometry is closer to blue than red due to the appendix-like peninsula.)
This is where I'm stuck. I want to cut the overlaps (purple parts) into two disjoint polygons along a line equidistant to the unbuffered polygons, and then subtract those slivers from the buffered counties.
I don't think I have a case of three or more overlapping buffers. I'll cross that bridge if and when I get to it.
It smells to me like something similar-but-not-quite-identical to using
ST_VoronoiPolygons but around polygons instead of points.
Does this exist either - ideally - as PostGIS functions, as QGIS geoprocessing functionality or maybe in some python libraries?