ST_Disjoint
定义
ST_Disjoint 获取两个 ST_Geometries,如果两个几何的交集生成空集,则返回 1 (Oracle) 或 t (PostgreSQL);否则返回 0 (Oracle) 或 f (PostgreSQL)。
语法
sde.st_disjoint (g1 sde.st_geometry, g2 sde.st_geometry)
返回类型
布尔型
示例
本示例创建两个表 sensitive_areas 和 hazardous_sites,然后向每个表中插入值。
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) );
SELECT 语句列出在危险废弃物场地的缓冲区范围外的所有敏感区域。在本查询中,可以使用 ST_Intersects 函数代替,只需将函数的结果等于 0,因为 ST_Intersects 和 ST_Disjoint 返回相反的结果。
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 sde.st_disjoint ((sde.st_buffer (hs.location, .1)), sa.zone) = 't' AND hs.id = 5; id 3
7/10/2012