Check and repair a polygon
Finds what is wrong with a polygon (crossed or touching edges, duplicate corners, spikes, holes outside the outline, clockwise rings), says where, and returns a repaired version: a bow-tie becomes two triangles.
A published result changed on 2026-09-23: Promoting this tool to stable removed EXPERIMENTAL_TOOL from its warnings, which moved GEOMETRY_INVALID from index 1 to index 0 and broke v001, which pinned the index. Nothing computed changed. v001 is superseded by v022, which names the warning by its code with the meta.warnings.*.code form the runner supports, so no warning sorting above it can shift it again -- the same fix geometry.area.polygon v030 took for the same reason. Changelog
Found 1 problem; the repaired polygon has 2 parts.
- Caution:1 problem found, the first a self-intersection: edges 1 and 3 cross or touch in ring 0 near 40.002000°, -104.997500°; the repaired polygon is returned.
| Problem | Ring | Corner or edge | Latitude | Longitude |
|---|---|---|---|---|
| self-intersection: edges 1 and 3 cross or touch | 0 | 1 | 40.0020001 deg | -104.9975000 deg |
| Latitude | Longitude | Part | Ring |
|---|---|---|---|
| 40.0020001 deg | -104.9975000 deg | 0 | 0 |
| 40.0000000 deg | -104.9950000 deg | 0 | 0 |
| 40.0040000 deg | -104.9950000 deg | 0 | 0 |
| 40.0020001 deg | -104.9975000 deg | 1 | 0 |
| 40.0040000 deg | -105.0000000 deg | 1 | 0 |
| 40.0000000 deg | -105.0000000 deg | 1 | 0 |
- Problems
- Repaired parts
- Repaired area
Provenance
- Computed by
- geometry.validity.make-valid 1.0.0, core 0.1.0
- Model
- Geodesic edges cut into 5 km pieces on an azimuthal equidistant plane at the corners' mean. Checks per OGC Simple Features §6.1.11.1: every pair of edges meeting other than at a shared corner, repeated corners, spikes (a corner where the ring doubles back), holes whose corners lie outside the outline; orientation per RFC 7946 is noted, not counted. Repair keeps each piece of edge with the even-odd interior on one side only, split where edges cross, and joins the pieces into rings
- Accuracy
- Crossings located to well under 1 mm on the plane for shapes of a few hundred kilometers; the repaired area by Karney's geodesic polygon area
- Notes
- 1 shown with the answer
- Cites
- Open Geospatial Consortium, OpenGIS Implementation Specification for Geographic information - Simple feature access - Part 1: Common architecture; IETF RFC 7946, The GeoJSON Format
Something look off?
How we got thisFormula, worked example, sources, and proof
Model: Geodesic edges cut into 5 km pieces on an azimuthal equidistant plane at the corners' mean. Checks per OGC Simple Features §6.1.11.1: every pair of edges meeting other than at a shared corner, repeated corners, spikes (a corner where the ring doubles back), holes whose corners lie outside the outline; orientation per RFC 7946 is noted, not counted. Repair keeps each piece of edge with the even-odd interior on one side only, split where edges cross, and joins the pieces into rings
Accuracy: Crossings located to well under 1 mm on the plane for shapes of a few hundred kilometers; the repaired area by Karney's geodesic polygon area
When to use this: Use this on any polygon that came from somewhere else before you compute with it. Digitised outlines, GPS traces closed into rings, shapes edited by hand and shapes converted between formats all arrive crossing themselves, doubling back, or repeating a corner, and an area or an overlay computed on one of those is quietly wrong rather than loudly broken. This says whether the shape is valid, points at each problem with the coordinate where it happens, and returns a repaired version with its area.
Limitations: Repair means finding the closest valid interpretation, not guessing what was meant: a bow tie becomes two triangles because that is what its boundary describes, even where the author meant one quadrilateral with two corners transposed. A repaired shape can therefore have a different area from the one intended, and can arrive in several parts, so the part count and the area are reported rather than hidden. Validity at degenerate rings is not settled between implementations — a repeated corner and a zero-area spike are read differently by different libraries, as the note records — so treat a verdict on those as this tool's reading rather than as the only one. The check runs on a plane at the shape's centre and is meant for shapes up to a few hundred kilometres.
Worked example: A bow-tie field boundary. Source: a bow tie: two triangles, with the crossing located. Checked against GEOS 3.11.4 through shapely over fourteen polygons — valid and crossed, at the equator, at 70 north and across the antimeridian — agreeing on every verdict and part count except two degenerate rings, where the repaired areas still agree to 6.2e-11 relative. It is golden test vector v022, and every build checks the tool still gives its answer within its tolerance.
You enter
- Polygon
- 40, -105 40.004, -104.995 40, -104.995 40.004, -105
You get
- Valid
- no
- Problems
- 1
- Repaired parts
- 2
- Repaired area
- 0.094814022 km²
Review: Not yet independently reviewed by a GIS professional.
Last verified: 2026-09-22, when a maintainer last confirmed this tool's sources at the issuer. See the sources ledger.
Status: version 1.0.0, core 0.1.0. See this tool in the verification report.
Changes
- 2026-09-23, result change: Promoting this tool to stable removed EXPERIMENTAL_TOOL from its warnings, which moved GEOMETRY_INVALID from index 1 to index 0 and broke v001, which pinned the index. Nothing computed changed. v001 is superseded by v022, which names the warning by its code with the meta.warnings.*.code form the runner supports, so no warning sorting above it can shift it again -- the same fix geometry.area.polygon v030 took for the same reason. Changelog
Checked against: 21 golden test vectors (download the test vectors, each with its source and tolerance). See how results are checked and every source.
Sources
- OpenGIS Implementation Specification for Geographic information - Simple feature access - Part 1: Common architecture, Open Geospatial Consortium, OGC 06-103r4, version 1.2.1. Section 6.1.11.1 (polygon validity: closed simple rings, holes inside the exterior, interiors connected).
- The GeoJSON Format, IETF RFC 7946, RFC 7946. Section 3.1.6 (exterior rings counterclockwise, holes clockwise).