I have a set of rectangular polygons, which currently form a directional path. The library I am using is Python Shapely / GeoPandas.
The issue I am having is as the path changes direction, there are small gaps and overlaps between the polygons.
I could iterate through all my polygon objects and calculate the angle in between each intersecting point and generate a new set of polygons but I figure there is a much better way.
I am fairly close - using the shapely buffer function, as seen in the following code snippet. I am able to remove the gaps, but it ends up merging my polygons into 1x. But I require them to remain 2x seperate polygons.
polygons = MultiPolygon([Polygon([(0, 0.5), (0, 2.5), (1, 2.5),(1,0.5)]),Polygon([(0, 0), (1, 1), (2,0),(1,-1)])]) polygons = polygons.buffer(2).buffer(-2)