The ST_SymDifference method finds the symmetric difference of two geometries.
The symmetric difference consists of all of those points that are in only one of the two geometries.
If the two geometry values consist of the same points, the ST_SymDifference method returns an
If the geometry-expression contains circular strings, then these are interpolated to line strings.
The following example shows the symmetric difference (C) of a square (A) and a circle (B).
SELECT NEW ST_Polygon( 'Polygon( (-1 -0.25, 1 -0.25, 1 2.25, -1 2.25, -1 -0.25) )' ) AS A
, NEW ST_CurvePolygon( 'CurvePolygon( CircularString( 0 1, 1 2, 2 1, 1 0, 0 1 ) )' ) AS B
, A.ST_SymDifference( B ) AS C
The following picture shows the result of the symmetric difference as the shaded portion of the picture.
The symmetric difference is a multisurface that includes two surfaces: one surface contains all of the points from the
square that are not in the circle, and the other surface contains all of the points of the circle that are
not in the square.