Overlap, union, or difference of two polygons
Where two areas overlap, their combined outline, what one has that the other lacks, or both, as valid polygons with geodesic areas, like the overlap of two geofences.
The result covers 0.18961711 km² in 1 part.
| Latitude | Longitude | Part | Ring |
|---|---|---|---|
| 40.0080000 deg | -104.9900000 deg | 0 | 0 |
| 40.0080001 deg | -104.9950000 deg | 0 | 0 |
| 40.0040000 deg | -104.9950000 deg | 0 | 0 |
| 40.0040001 deg | -104.9900000 deg | 0 | 0 |
- Parts
- First polygon's area
- Second polygon's area
Provenance
- Computed by
- geometry.overlay.boolean 1.0.0, core 0.1.0
- Model
- Both polygons' geodesic edges cut into 5 km pieces on one azimuthal equidistant plane at their corners' mean, each read by the even-odd rule; every piece of either boundary is kept exactly when the result's inside differs on its two sides, and the pieces are joined into rings. Areas by Karney's geodesic polygon area (Karney 2013)
- Accuracy
- Edges follow the geodesics to about 1 mm for shapes of a few hundred kilometers; areas exact for the returned corners. Inputs within 5,000 km of their shared center
- Notes
- None
- Cites
- Karney, C. F. F., Journal of Geodesy, Algorithms for geodesics
Something look off?
How we got thisFormula, worked example, sources, and proof
Model: Both polygons' geodesic edges cut into 5 km pieces on one azimuthal equidistant plane at their corners' mean, each read by the even-odd rule; every piece of either boundary is kept exactly when the result's inside differs on its two sides, and the pieces are joined into rings. Areas by Karney's geodesic polygon area (Karney 2013)
Accuracy: Edges follow the geodesics to about 1 mm for shapes of a few hundred kilometers; areas exact for the returned corners. Inputs within 5,000 km of their shared center
When to use this: Use this to ask how two areas relate as areas rather than as outlines: how much of a flight restriction falls inside a planned survey block, what a parcel keeps after a right of way is taken out of it, the combined footprint of two coverage zones, the part of a search area nobody has swept yet. It answers with the polygon itself and with its area on the ellipsoid, so the result can be drawn, measured, or fed straight back in.
Limitations: Both polygons and their result must sit within 5,000 km of their shared centre, because the overlay is done on one plane placed there and a plane cannot hold more of the Earth than that faithfully; further apart and the tool refuses rather than distorting. Edges are cut into 5 km pieces before the overlay, so a result boundary follows the geodesic to about a millimetre rather than exactly. A result can be empty, or break into several pieces, or acquire a hole, all of which are reported rather than treated as failure — a difference that leaves nothing is a correct answer. Self-intersecting inputs have no well-defined inside and should be repaired first.
Worked example: Where two geofences overlap. Source: GEOS 3.11.4 through shapely, the reference implementation for this operation, run on the same azimuthal equidistant plane and measured back on the ellipsoid by geographiclib: over ten cases across all four operations the areas agree to 2.2e-11 relative and the part counts exactly. It is golden test vector v001, and every build checks the tool still gives its answer within its tolerance.
You enter
- Operation
- intersection
- First polygon
- 40, -105 40, -104.99 40.008, -104.99 40.008, -105
- Second polygon
- 40.004, -104.995 40.004, -104.985 40.012, -104.985 40.012, -104.995
You get
- Result area
- 0.18961711 km²
- Parts
- 1
- First polygon's area
- 0.7584903 km²
- Second polygon's area
- 0.75844656 km²
Review: Not yet independently reviewed by a GIS professional.
Last verified: 2026-09-18, 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.
Checked against: 22 golden test vectors (download the test vectors, each with its source and tolerance). See how results are checked and every source.
Sources
- Algorithms for geodesics, Karney, C. F. F., Journal of Geodesy, Vol. 87, No. 1. pp. 43-55 (direct and inverse problems; area of geodesic polygons, section 6).