Amazon Redshift will no longer support the use of Python UDFs after June 30, 2026.
We will start enforcing it in phases. For more information on the details of Python end of life
and migration options, see the
blog post
ST_Touches
ST_Touches returns true if the 2D projections of the two input geometries touch. The two geometries touch if they are nonempty, intersect, and have no interior points in common.
Syntax
ST_Touches(geom1, geom2)
Arguments
- geom1
-
A value of data type
GEOMETRYor an expression that evaluates to aGEOMETRYtype. - geom2
-
A value of data type
GEOMETRYor an expression that evaluates to aGEOMETRYtype.
Return type
BOOLEAN
If geom1 or geom2 is null, then null is returned.
If geom1 and geom2 don't have the same value for the spatial reference system identifier (SRID), then an error is returned.
If geom1 or geom2 is a geometry collection, then an error is returned.
Examples
The following SQL checks if a polygon touches a linestring.
SELECT ST_Touches(ST_GeomFromText('POLYGON((0 0,10 0,0 10,0 0))'), ST_GeomFromText('LINESTRING(20 10,20 0,10 0)'));
st_touches
-------------
t