使用與參考手冊

ST_Difference

ST_Difference 使用兩個幾何物件並傳回一個與來源物件不同的幾何物件。

語法

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

回覆類型

db2gse.ST_Geometry

範例

都市工程師必須知道都市用地區域中尚未蓋建築物的總區域。 亦即都市工程師想要除去建築區域之後的用地總計。

CREATE TABLE BUILDINGFOOTPRINTS (   building_id integer,
                                    lot_id      integer,
                                         footprint   db2gse.ST_MultiPolygon);
CREATE TABLE LOTS ( lot_id   integer,
                    lot     db2gse.ST_MultiPolygon);

都市工程師在 lot_id 上等式合併 BUILDINGFOOTPRINTS 與 LOTS 表格。 然後工程師以用地的差異區域總和減去建築物覆蓋區。

SELECT SUM(db2gse.ST_Area(db2gse.ST_Difference(lot,footprint)))
  FROM BUILDINGFOOTPRINTS bf, LOTS
WHERE bf.lot_id = LOTS.lot_id; 


[ 頁面頂端 | 前一頁 | 下一頁 | 目錄 | 索引 ]