ST_UnaryUnion

更新时间:
复制 MD 格式

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 default -1.0, cstring options default '{}'); 
geometry ST_UnaryUnion(geometry geom , cstring options);

Parameters

Parameter Name

Description

geom

The Geometry object. This is typically a complex Geometry, MultiGeometry, or GeometryCollection.

gridsize

The grid size. Vertices in the same grid are merged during the union operation. The default value is -1.0, which disables this parameter.

options

Use this parameter to enable parallel execution and specify the degree of parallelism.

The degree of parallelism ranges from 1 to 64. The value must be a JSON string. For example, '{"parallel": 4}' enables parallel computing and sets the degree of parallelism to 4. The default value is '{}', which specifies sequential execution.

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;