This topic describes the ST_UnaryUnion function. This function aggregates a complex geometry object and returns a new geometry object.
Syntax
geometry ST_UnaryUnion(geometry geom, float8 gridsize defalut -1.0, cstring options default '{}');
geometry ST_UnaryUnion(geometry geom , cstring options);
Parameters
Parameter | Description |
---|---|
geom | The geometry object that you want to specify. In most cases, the geometry object is a complex geometry, a MultiGeometry, or a GeometryCollection. |
gridsize | The size of the grid that you want to specify. This parameter is used to merge vertices in the same grid when you perform a union operation. The default value is -1.0, which indicates that this parameter is disabled. |
options | The state of the parallel computing feature and the degree of parallelism that you
want to specify.
The degree of parallelism ranges from 1 to 64. The value of this parameter is a JSON string, such as |
Examples
select st_area(st_union(geom)) from tableA where id = 1;
select st_area(st_union(geom, 0.005)) from tableA where id = 1;
select st_area(st_union(geom, '{"parallel": 4}'::cstring)) from tableA where id = 1;