The ST_Disjoint function takes two geometries
as input parameters and returns 1 if the given geometries do not intersect.
If the geometries do intersect, then 0 (zero) is returned.
If the second geometry is not represented in the same
spatial reference system as the first geometry, it will be converted
to the other spatial reference system.
If any of the two geometries
is null or is empty, then null value is returned.
This function
can also be called as a method.
Syntax
Parameter
geometry1
A value of type ST_Geometry that represents the geometry that
is tested to be disjoint with geometry2.
geometry2
A value of type ST_Geometry that represents the geometry that
that is tested to be disjoint with geometry1.
Return type
INTEGER
Examples
Example 1
This code creates several geometries in the SAMPLE_GEOMETRIES
table.
SET CURRENT FUNCTION PATH = CURRENT FUNCTION PATH, db2gse
CREATE TABLE sample_geoms (id INTEGER, geometry ST_Geometry)
INSERT INTO sample_geoms VALUES
(1, ST_Geometry('polygon((20 30, 30 30, 30 40, 20 40, 20 30))',0))
INSERT INTO sample_geoms VALUES
(2, ST_Geometry('polygon((30 30, 30 50, 50 50, 50 30, 30 30))',0))
INSERT INTO sample_geoms VALUES
(3, ST_Geometry('polygon((40 40, 40 60, 60 60, 60 40, 40 40))',0))
INSERT INTO sample_geoms VALUES
(4, ST_Geometry('linestring(60 60, 70 70)' ,0))
INSERT INTO sample_geoms VALUES
(5, ST_Geometry('linestring(30 30, 40 40)' ,0))
Example 2
This example determines if the first polygon is disjoint from
any of the geometries.
SELECT a.id, b.id, ST_Disjoint(a.geometry, b.geometry) DisJoint
FROM sample_geoms a, sample_geoms b
WHERE a.id = 1