What Is a Geometric Union?
The union operation combines two or more overlapping polygons into a single polygon that covers the total area of all inputs. Where polygons overlap, the shared boundary is dissolved and the combined shape is returned as one geometry.
How to Use the Union Tool
Provide GeoJSON polygons and the tool computes their union. Non-overlapping polygons are returned as a MultiPolygon. Overlapping polygons are merged into a single continuous shape. The result preserves the outer boundary while removing internal boundaries.
When You Want One Shape Instead of Many
- Combining adjacent administrative regions into a single boundary
- Merging overlapping buffer zones into a unified coverage area
- Creating a single outline from multiple overlapping parcels
- Simplifying complex multi-part boundaries for display purposes
Compare with merge (concatenates features without spatial combination), turf.dissolve() (merges features sharing a property value), andturf.intersect() (returns only the shared area).
Two Overlapping Rectangles
Union two overlapping rectangles, one around Times Square and one around Central Park. The rectangles share an overlapping strip in between:
GeoJSON{
"type": "Feature",
"properties": { "name": "Times Square Area" },
"geometry": {
"type": "Polygon",
"coordinates": [[[-73.99, 40.75], [-73.98, 40.75], [-73.98, 40.77], [-73.99, 40.77], [-73.99, 40.75]]]
}
}GeoJSON{
"type": "Feature",
"properties": { "name": "Central Park Area" },
"geometry": {
"type": "Polygon",
"coordinates": [[[-73.985, 40.76], [-73.975, 40.76], [-73.975, 40.79], [-73.985, 40.79], [-73.985, 40.76]]]
}
}The result is a single Polygon covering the combined area of both rectangles. The overlapping strip between 40.76 and 40.77 latitude is merged seamlessly, no internal boundary remains. On the map, you see one L-shaped polygon instead of two overlapping rectangles.
Folding Many Polygons Into One
@turf/union takes two polygons at a time. To handle collections, this tool gathers every Polygon and MultiPolygon across both inputs and folds them left to right: the first two are unioned, that result is unioned with the third, and so on. The tool reports how many polygons went into the answer, so you can check it against your input.
Underneath, the algorithm finds every intersection point between polygon edges and traces the outermost boundary. Polygons that do not touch still union successfully and come back as a MultiPolygon with separate parts. Features that are not polygons are counted and reported, because a union is an areal operation with nothing sensible to do with a point.