ST_UNION
functionsupportedCore SQL functionsGiven two input GEOGRAPHY objects, returns a GEOGRAPHY object that represents the combined set of shapes for both objects (i.e. the union of the two shapes).
Syntax
ST_UNION( <geography_expression_1> , <geography_expression_2> )
Parameters
| Name | Required | Description |
|---|---|---|
geography_expression_1 | required | A GEOGRAPHY object. |
geography_expression_2 | required | A GEOGRAPHY object. |
Returns
The function returns a value of type GEOGRAPHY.
Usage notes
- If any vertex of one input object is on the boundary of the other input object (excluding the vertices), some points in the union might be represented more than once in the output, For example, in the following statement: Copy code SELECT ST_UNION( TO_GEOGRAPHY('POINT(1 1)'), TO_GEOGRAPHY('LINESTRING(1 0, 1 2)') ); POINT(1 1) is on the boundary of LINESTRING(1 0, 1 2) but is not a vertex of it. In this example, ST_UNION is not guaranteed to produce minimal output. The expected output should be the input linestring: Copy code LINESTRING(1 0, 1 2) But the actual output might be: Copy code GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(1 0,1 1,1 2)) where POINT (1,1) is represented twice in the output: once as the point itself and once as a point within the LineString.