Name

ST_UnaryUnion — Like ST_Union, but working at the geometry component level.

Synopsis

geometry ST_UnaryUnion(geometry geom, float8 gridSize);

Description

Unlike ST_Union, ST_UnaryUnion does dissolve boundaries between components of a multipolygon (invalid) and does perform union between the components of a geometrycollection. Each components of the input geometry is assumed to be valid, so you won't get a valid multipolygon out of a bow-tie polygon (invalid).

You may use this function to node a set of linestrings. You may mix ST_UnaryUnion with ST_Collect to fine-tune how many geometries at once you want to dissolve to be nice on both memory size and CPU time, finding the balance between ST_Union and ST_MemUnion.

If a gridSize argument is provided, the inputs are snapped to a grid of the given size and all intersections are computed on that same grid. This method requires GEOS-3.9.0 or higher.

This function supports 3d and will not drop the z-index.

Availability: 2.0.0

Enhanced: 3.1.0 accept a gridSize parameter.

See Also

ST_Union, ST_MemUnion, ST_Collect, ST_Node