How to Merge Overlapping Polygons into One Area
- API or service
- Geometry Operations API
- Task
- Two or more polygons → combined coverage
- Examples
- Difficulty
- Beginner
- Time
- 7 min
Merge overlapping polygons into one area
You have delivery zones, properties, service areas, or administrative shapes that overlap and need their total coverage without duplicate geometry. Send the polygons to the Geometry Operations API union operation.
Task flow: two or more Polygon/MultiPolygon geometries → union → combined Polygon or MultiPolygon.
Union is the correct preparation step before measuring total covered area. Adding the source polygon areas directly would count overlaps more than once.
The request accepts between 2 and 100 polygon geometries. If all inputs touch or overlap, the result is commonly one Polygon; spatially separate groups can produce a MultiPolygon.
Union the polygons
These two rectangles overlap in central Berlin:
POST https://api.geoapify.com/v1/geometry/operation?apiKey=YOUR_API_KEY
Content-Type: application/json
{
"operation": "union",
"polygons": [
{
"type": "Polygon",
"coordinates": [[
[13.38, 52.50], [13.42, 52.50],
[13.42, 52.54], [13.38, 52.54],
[13.38, 52.50]
]]
},
{
"type": "Polygon",
"coordinates": [[
[13.40, 52.51], [13.44, 52.51],
[13.44, 52.55], [13.40, 52.55],
[13.40, 52.51]
]]
}
]
}
The response is one outline with the internal overlap removed:
{
"type": "geojson",
"data": {
"type": "Feature",
"properties": {},
"geometry": {
"type": "Polygon",
"coordinates": [[
[13.38, 52.50], [13.42, 52.50],
[13.42, 52.51], [13.44, 52.51],
[13.44, 52.55], [13.40, 52.55],
[13.40, 52.54], [13.38, 52.54],
[13.38, 52.50]
]]
}
}
}
Read the combined geometry from data.geometry. Preserve all parts when its type is MultiPolygon.