ST_SymmetricDiff

定义

ST_SymmetricDiff 以两个 ST_Geometry 对象作为输入参数,返回由源对象的非公共部分组成的几何对象。

语法

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

返回类型

ST_Geometry

示例

对于特定报表,县政委员必须确定未相交的敏感区域和危险场地半径区域。

除用于存储机构 ST_Polygon 几何的区域列外,sensitive_areas 表还包含几个用于描述受威胁机构的列。

hazardous_sites 表在 site_id 和名称列中存储场地标识,而各场地的实际地理位置存储在位置点列中。

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)
);

ST_Buffer 函数生成一个环绕危险废弃物场地位置的缓冲区域。ST_SymmetricDiff 函数将返回不相交的缓冲危险废弃物场地和敏感区域的面。

Oracle

SELECT sa.id SA_ID,hs.id HS_ID,
sde.st_area (sde.st_symmetricdiff (sde.st_buffer (hs.location, .1), sa.zone)) AREA_NO_INT
FROM HAZARDOUS_SITES hs, SENSITIVE_AREAS sa
WHERE hs.id = 4;

     SA_ID    HS_ID   AREA_NO_INT

         1        4    100.031393
         2        4    400.031393
         3        4    400.015697

PostgreSQL

SELECT sa.id AS SA_ID, hs.id AS HS_ID,
sde.st_area (sde.st_symmetricdiff (sde.st_buffer (hs.location, .1), sa.zone)) AS "no intersection"
FROM hazardous_sites hs, sensitive_areas sa
WHERE hs.id = 4;

    sa_id   sa_id   no intersection

         1        4    100.031393
         2        4    400.031393
         3        4    400.015697

危险废弃物场地与敏感区域的交际取反操作用于生成相交区域的差集。


7/10/2012