prepair—pronounce ‘pee-repair’ as in ‘polygon repair’—permits us to easily repair ‘broken’ GIS polygons according to the international standards ISO19107 (Geographic information—Spatial schema) and OGC Simple Feature. Given one input polygon (or a MultiPolygon), it automatically repairs it and returns back a valid polygon (actually a MultiPolygon since the input can represent more than one polygon, think of a ‘bowtie’ for instance).
It is an open-source project released under the GPL licence. We offer here a simplified version: only the WKT of a polygon (or MultiPolygon) can be given as input, and it is repaired with an extension of the odd-even algorithm to handle GIS polygons containing inner rings and degeneracies. Also, only rather small WKT are supported.
For repairing bigger polygons in shapefiles for instance, or for more repairing options, download the code and compile it. We also offer Windows binaries and a plugin for QGIS.
Most of the details of the implementation are available in this scientific article:
Ledoux, H., Arroyo Ohori, K., and Meijers, M. (2014). A triangulation-based approach to automatically repair GIS polygons. Computers & Geosciences 66:121-131.
If you encounter a bug, please report it on the issue page.