ArcGIS Server Banner

ST_Disjoint

ST_Disjoint

Release 9.3 E-mail This TopicPrintable VersionGive Us feedback

Definition

ST_Disjoint takes two geometries and returns 1 (Oracle) or t (PostgreSQL) if the intersection of two geometries produces an empty set; otherwise, it returns 0 (Oracle) or f (PostgreSQL).

Syntax

Oracle

sde.st_disjoint (g1 sde.st_geometry, g2 sde.st_geometry)

PostgreSQL

st_disjoint (g1 st_geometry, g2 st_geometry)

Return type

Boolean

Example

This example creates two tables, sensitive_areas and hazardous_sites, and inserts values into each.

Oracle

CREATE TABLE sensitive_areas (id integer, 
                               zone sde.st_geometry); 

CREATE TABLE hazardous_sites (id integer, 
                              location sde.st_geometry); 

INSERT INTO sensitive_areas VALUES (
1,
sde.st_polygon ('polygon ((20 30, 30 30, 30 40, 20 40, 20 30))', 0)
);

INSERT INTO sensitive_areas VALUES (
2,
sde.st_polygon ('polygon ((30 30, 30 50, 50 50, 50 30, 30 30))', 0)
);

INSERT INTO sensitive_areas VALUES (
3,
sde.st_polygon ('polygon ((40 40, 40 60, 60 60, 60 40, 40 40))', 0)
);

INSERT INTO hazardous_sites VALUES (
4,
sde.st_point ('point (60 60)', 0)
);

INSERT INTO hazardous_sites VALUES (
5,
sde.st_point ('point (30 30)', 0)
);

PostgreSQL

CREATE TABLE sensitive_areas (id integer, 
                               zone st_geometry); 

CREATE TABLE hazardous_sites (id integer, 
                              location st_geometry); 

INSERT INTO sensitive_areas VALUES (
1,
st_polygon ('polygon ((20 30, 30 30, 30 40, 20 40, 20 30))', 0)
);

INSERT INTO sensitive_areas VALUES (
2,
st_polygon ('polygon ((30 30, 30 50, 50 50, 50 30, 30 30))', 0)
);

INSERT INTO sensitive_areas VALUES (
3,
st_polygon ('polygon ((40 40, 40 60, 60 60, 60 40, 40 40))', 0)
);

INSERT INTO hazardous_sites VALUES (
4,
st_point ('point (60 60)', 0)
);

INSERT INTO hazardous_sites VALUES (
5,
st_point ('point (30 30)', 0)
);

The SELECT statement lists the names of all sensitive areas that are outside the buffer of a hazardous waste site. You could use the ST_Intersects function instead in this query by equating the result of the function to 0, because ST_Intersects and ST_Disjoint return the opposite results.

Oracle

SELECT sa.id
FROM sensitive_areas sa, hazardous_sites hs
WHERE sde.st_disjoint ((sde.st_buffer (hs.location, .1)), sa.zone) = 1
AND hs.id = 5;

ID

3

PostgreSQL

SELECT sa.id
FROM sensitive_areas sa, hazardous_sites hs
WHERE st_disjoint ((st_buffer (hs.location, .1)), sa.zone) = 't'
AND hs.id = 5;

id

3

See Also

  • An overview of SQL functions used with ST_Geometry types
  • Spatial relationships