This topic describes the ST_SymDifference function. This function returns a geometry object representing the part that Geometry Object A does not intersect with Geometry Object B.

Syntax

geometry  ST_SymDifference(geometry  geomA , geometry  geomB);

Parameters

Parameter Description
geomA Geometry Object A that you want to specify.
geomB Geometry Object B that you want to specify.

Description

  • This function does not support GeometryCollection objects.
  • This function supports 3D objects and does not delete z coordinates. This function processes only the x and y coordinates of the input geometry objects. This function returns the output geometry object with the original z coordinates.

Examples

Results returned by using the default parameter settings:
SELECT ST_AsText(ST_SymDifference('LINESTRING(0 0,2 0)'::geometry,'LINESTRING(1 0,3 0)'::geometry));
              st_astext
--------------------------------------
 MULTILINESTRING((0 0,1 0),(2 0,3 0))
(1 row)