Skip to content

ST_TOUCHES

Returns TRUE if two GEOGRAPHY objects share at least one point on their boundaries, while their interiors do not intersect.

This function is symmetric:

  • ST_TOUCHES(A, B) = ST_TOUCHES(B, A)

See also:

Syntax

sql
ST_TOUCHES(<a>, <b>)

Arguments

  • <a> and <b>: Two GEOGRAPHY objects to test

Returns

Returns a BOOLEAN:

  • TRUE if the geographies touch (share boundary points but no interior points)
  • FALSE if the geographies don't touch or if either input is a point (points have no boundary)

Example

sql
SELECT ST_TOUCHES('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'::GEOGRAPHY,
                  'POLYGON((1 0, 2 0, 2 1, 1 1, 1 0))'::GEOGRAPHY);
-- TRUE