Name

ST_Touches — Tests if a Geometry spatially touches another Geometry.

Synopsis

boolean ST_Touches(bytea GeomA, bytea GeomB);

Alias

Touches

Description

Tests if a Geometry spatially touches another Geometry, returns TRUE if so.

The Touches relation between two geometries a and b applies to the A/A, L/L, L/A, P/A and P/L groups of relationships but not to the P/P group (returns False if both Geometries are points).

The overlaps predicate has the following equivalent definitions:

  • The geometries have at least one point in common, but their interiors do not intersect.

  • a.Touches(b) «-» (I(a)∩I(b) = ᴓ) Ʌ (a ∩ b) ≠ᴓ

  • Expressed in terms of the DE-9IM: FT*******, F**T***** or F***T****

[Note]

GeometryCollections are unsupported

Coordinate Dimensions
2D3DM
Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006)SQL-MM Part 3
2.1.1.2 , 2.1.13.37.2.19.17.2.8.15.1.28

Examples

SELECT ST_Touches(PA,PB) from (SELECT 
ST_GeomFromText('POLYGON ((10 30, 0 10, 30 20, 30 30, 20 40, 10 30))') as PA, 
ST_GeomFromText('POLYGON ((-1.5 40, 20 40, 10 30, -1 35, -1.5 40))') as PB) as foo;
--Result
TRUE

ST_Touches(A,B) returns True in the following situations

Related functions

ST_Relate,ST_Crosses,ST_Intersects