I use OGR & Python to develop a geodesic polygon buffer. The buffered polygon is generated from a polyline ring. The polyline ring is generated from point coordinates. As the polyline ring is often self-intersecting, this leads to holes in the buffered polygon geometry. For the outer boundary of a self-intersecting line / polygon, applying a Buffer of 0 to the buffered polygon geometry is a widely used workaround to fill holes from self-intersections and to generate a correctly displayed polygon. However, I have difficulties buffering polygons with holes.
A (buffered) polygon with a hole consists of two lines: An outer line from which I want to determine the most outer boundary (using a Buffer of 0) and an inner line, from which i want to determine the most inner boundary. The workaround using a Buffer of 0 only determines the most outer boundary of a self-intersecting polygon. I am thereby looking for a workaround in order to determine the most inner boundary of a self-intersecting polygon (for applying the buffer to the hole).
The polygon I want to buffer:
I applied several buffer widths. The polyline rings and buffer vertices for the respective buffer polygons are displayed here. In order to create a buffered polygon with a hole inside, I need to determine the most outer boundary of the outer line and the most inner boundary of the inner line:
The polylines are self-intersecting and lead to Polygons with small holes (hole in the top right corner of the polygon):
As for the outer boundary, I use a Buffer of 0 in order to determine the most outer boundary of the outer Polyline. At this point, the hole in the top right corner is closed:
However, this approach can not be used for the inner ring of the polygon. I need to determine the most inner boundary of the self-intersecting inner polyline (Lines inside the hole in Image 2). From both, outer line with outer boundary (which I already have) and inner line with inner boundary I want to generate a buffered polygon with a hole inside.
Is there a workaround for this?