ST_Touches(A, B) returns true if both the following are true:
- At least one point in the set of points that comprises A is also a member of the set of points that make up B.
- No points that make up the interior of A are also part of the interior of B.
ST_Touches works on the following data types:
ST_Touches will attempt to use any available spatial index to speed up its operation.
Use the prefixed variant _ST_Touches if you do not want any spatial indexes to be used.Examples
The screenshots in these examples were generated using geojson.io, but they are designed to
showcase the shapes, not the map. Representing
GEOMETRY data in GeoJSON can lead to unexpected results if using
geometries with SRIDs other than 4326 (as shown below).True
In this example,ST_Touches returns true because both of the following are true:
- At least one point in the set of Points that comprise Polygon A is a member of the set of points that make up the LineString B.
- No points from the interior of A are also part of the interior of B.

False
In this example,ST_Touches returns false because:
- Some points from the interior of the LineString B are also part of the interior of the Polygon A.

See also
- Export Spatial Data
- Spatial tutorial
- Spatial and GIS Glossary of Terms
- Spatial indexes
- Spatial functions
ST_CoversST_CoveredByST_ContainsST_WithinST_IntersectsST_CoveredByST_CoversST_DisjointST_EqualsST_OverlapsST_ConvexHullST_Union- Migrate from Shapefiles
- Migrate from GeoJSON
- Migrate from GeoPackage
- Migrate from OpenStreetMap
- Introducing Distributed Spatial Data in CockroachDB (blog post)
- Using GeoServer with CockroachDB

