User's Guide and Reference

ST_Touches

ST_Touches returns 1 (TRUE) if none of the points common to both geometries intersect the interiors of both geometries; otherwise, it returns 0 (FALSE). At least one geometry must be a linestring, polygon, multilinestring, or multipolygon.

Syntax

db2gse.ST_Touches(g1 db2gse.ST_Geometry, g2 db2gse.ST_Geometry)

Return type

Integer

Examples

The GIS technician needs to provide a list of all sewer lines whose endpoints intersect another sewerline.

The following CREATE TABLE statement creates the SEWERLINES table, which has three columns. The first column, SEWER_ID, uniquely identifies each sewer line. The second column, CLASS, of type integer identifies the type of sewer line, which is generally associated with the line's capacity. The third column, SEWER, of type linestring stores the sewer line's geometry.

CREATE TABLE SEWERLINES (sewer_id integer, class integer, sewer db2gse.ST_LineString);

The following SELECT statement returns an ordered list of SEWER_IDS that touch one another.

SELECT s1.sewer_id, s2.sewer_id
FROM sewerlines s1, sewerlines s2
WHERE db2gse.ST_Touches (s1.sewer, s2.sewer) = 1,
ORDER BY 1,2;


[ Top of Page | Previous Page | Next Page ]