I have two polygons,
POLYGON((-5 -5,-5 5,5 5,5 -5,-5 -5)) POLYGON((1 1, 1 7, 7 7, 7 1, 1 1))
and wish to split them evenly. The result should be a split along the red marked line.
I'm using qgis/ python shapely and wish to do it using python.
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
I used an approach with voronoi polygons once. I did it by and hand I only have a vague idea of how you could do it with shapely, but here's how it goes.
First, you extract the vertices of each overlapping polygons and create Voronoi polygons from them (vector > geometry tools > extract nodes & vector > geometry tools > vononoi). With the resulting shape, you can draw the line that splits your overlapping area exactly in two. (The bright green line)
You clip the voronoi layer with the overlapping polygon and remove the overlap from the original shapes and paste the clipped voronoi polygon back with your original shapes. Select, merge, voilà!
Now, it looks a little crude, because mine are really simple shapes. But, it you densify it (Vector > Geometry tools > Density geometries) and add like 20 nodes between each existing vertex, you can have this:
Which is much better. Easy if you only have a small amount of shapes to modify.