ST_CoverageUnion
What is ST_CoverageUnion?
ST_CoverageUnion is a PostGIS aggregate function that unions a set of polygons that form a valid coverage. Because adjacent polygons already share identical edges, the union can skip expensive overlay processing and simply dissolve shared edges — far faster than ST_Union on the same input.
ST_CoverageUnion(geometry set geom) → geometryThe result is a single polygon or multipolygon representing the merged coverage.
When would you use ST_CoverageUnion?
Use ST_CoverageUnion to dissolve a large coverage into a single outline — merging census tracts into a state outline, combining parcel records into a neighbourhood boundary, or turning a tiled land-cover dataset into a simple extent polygon. It is dramatically faster than ST_Union when the input is a valid coverage.
1SELECT ST_CoverageUnion(geom) AS state_outline
2FROM county_boundaries
3WHERE state = 'CA';FAQs
How much faster is this than ST_Union?
For large valid coverages, typically one to two orders of magnitude. ST_Union overlays every pair of polygons; ST_CoverageUnion just removes shared edges, which is near-linear in the number of vertices. On a coverage with 100k polygons, the difference can be minutes versus seconds.
What if the input is not a valid coverage?
The result is undefined — possibly invalid, possibly missing areas. Always verify with ST_CoverageInvalidEdges first, or fall back to ST_Union for general (non-coverage) input.
Do the polygons have to share exact vertex coordinates?
Yes. "Valid coverage" requires that shared edges have identical vertex positions. Use ST_Snap or ST_ReducePrecision to align near-matching edges before dissolving, or use ST_Union if alignment is imperfect.
Can the result have holes?
Yes. If the coverage surrounds an internal gap (a lake inside a land classification, an island of another polygon class), the union will produce a polygon with holes to represent those interior exclusions.