How to repair a polygon with self-intersection?

Alexander picture Alexander · Nov 24, 2010 · Viewed 9.2k times · Source

Is there a way to remove self-intersections from a polygon using GEOS?

Answer

Alexander picture Alexander · Dec 8, 2010

So, I have to answer the question myself. Maybe it will help someone.

You can repair a polygon using the geos::operation::buffer::BufferOp class. E.g.

geos::geom::Geometry * result = 
                       geos::operation::buffer::BufferOp::bufferOp(polygon, 1.0);

You can find some more good recipes in the Secrets of the JTS Topology Suite.