- Categories:
ST_ SYMDIFFERENCE¶
Given two input GEOGRAPHY objects, returns a GEOGRAPHY object that represents the set of points from both input objects that are not part of the intersection of the objects (i.e. the symmetric difference of the two objects).
- See also:
Syntax¶
Arguments¶
geography_expression_1A GEOGRAPHY object.
geography_expression_2A GEOGRAPHY object.
Returns¶
The function returns a value of type GEOGRAPHY.
If geography_expression_1 and geography_expression_2 are equal (i.e. the symmetric difference is an empty set
of points), the function returns NULL.
Usage notes¶
- If any vertex of one input object is on the boundary of the other input object (excluding the vertices), the output might not be accurate.
- The function is not guaranteed to produce normalized and/or minimal results. For example, an output could consist of a LineString containing several Points that actually forms just one straight segment.
Examples¶
The following example returns a GEOGRAPHY object that represents the symmetric difference between two input GEOGRAPHY objects:
This example produces the following output:
The following images illustrate the differences in the areas that represent the input and output objects:
| Input | Output |
|---|---|
![]() | ![]() |

