0

The purple is the original polygon to be smoothed and I would like to smooth the polygons as the red line using Python.

I tried simplify but looks like I need a buffer and simplify the buffer. But I want to simplify the polygon directly. I am open to any other methods using Python.

import geopandas as gpd

d = gpd.read_file('poly.shp')
x = d.buffer(0.0001)

tolerance = 0.00005
simplified = x.simplify(tolerance, preserve_topology=True)
simplified.to_file('simplified.shp')

enter image description here

  • Why do you need simplify for smoothing the polygon? – Kadir Şahbaz Apr 4 '19 at 9:45
  • 1
    The simplify method is a Ramer-Douglas-Peucker vertex removal algorithm. If you want a Bend-Simplify or something more exotic you might have to code it yourself. – Vince Apr 4 '19 at 10:47
  • maybe github.com/bmitto/bend-simplify – Ian Turton Apr 4 '19 at 10:58
  • You don't need a buffer; the example you linked to is just using a buffer to create a polygon from a point. You can simplify your polygon/polyline directly. – Jon Mar 12 at 21:05
1

This solution worked for me. Just adjust the buffer amount to work with your units.

Solution copied here:

polygon.buffer(10, join_style=1).buffer(-10.0, join_style=1)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy