5. Geospatial Functions : Touches
 
Share this page                  
Touches
TOUCHES(g1 Geometry, g2 Geometry)
Alias: ST_TOUCHES
Returns 1 if g1 and g2 share one or more points along their edges but do not overlap; returns 0 if they overlap or do not share points.
Result type: integer
Examples:
SELECT TOUCHES(POLYFROMTEXT('POLYGON((0 13, 10 13, 10 3, 2 3, 0 13))'), POLYFROMTEXT('POLYGON((10 13, 20 13, 18 3, 10 3, 10 13))'));
-------------
col1
-------------
1
-------------
 
SELECT TOUCHES(POLYFROMTEXT('POLYGON((0 13, 10 13, 10 3, 2 3, 0 13))'), POLYFROMTEXT('POLYGON((6 13, 16 13, 14 3, 6 3, 6 13))'));
-------------
col1
-------------
0
-------------