Obtain smooth polygons

GoodMoning, Im working with many polygons obtained with a countour function of GDAL. I need smooth them and actually I’m using library
“from skimage.measure import find_contours, approximate_polygon, subdivide_polygon”
as found online.

But as shown in the attachment I need that the smoother polygon is located outside initial polygons or completely inside.

Can someone help me suggesting other libraries, if exist, or other methodologies?

Many thanks


Hi Dset,

smoothing polygons generally can e.g. also be done using scipy.interpolate.CubicSpline(…) - or other splines.

What you are looking for might be “constrained splines”, or similar, but huh, that might be mathematically tough…

If you just want to ensure, that all points of the orange smooth curve are inside or outside the area of the blue curve and there is no special mathematical meaning to that, you could just enlarge the area of the blue curve BEFORE fitting the orange curve and then switch back the blue to the original size, or alike?

Cheers, Dominik