如何从Oracle中删除多边形中的孔

时间:2018-08-27 06:52:45

标签: sql oracle spatial oracle-spatial

我有多边形polygon

这是一个几何!

WITH Dups AS ( SELECT [Column 2], [Column 3], ..., [Column 15], SUM([Numeric Column]) AS [Sum Of Numeric Column], COUNT(*) AS [Amount Of Aggregated Records] FROM dbo.MyLargeTable WITH (NOLOCK) GROUP BY [Column 2], [Column 3], ..., [Column 15] HAVING COUNT(*) > 1 ), REGS AS ( SELECT [Column 2], [Column 3], ..., [Column 15], [Numeric Column], 1 AS [Amount Of Aggregated Records] FROM dbo.MyLargeTable WITH (NOLOCK) GROUP BY [Column 2], [Column 3], ..., [Column 15] HAVING COUNT(*) = 1 ) SELECT * FROM Regs UNION ALL SELECT * FROM Dups ORDER BY SomeCol

我把它画出来 polygon with hole

这是一个几何!

MDSYS.SDO_GEOMETRY(2003, 2400000, null, MDSYS.SDO_ELEM_INFO_ARRAY(1, 1003, 1), MDSYS.SDO_ORDINATE_ARRAY( 8432760.28444425, 4547222.21132491, 8432767.40437640, 4547207.64930884, 8432787.32577175, 4547207.51350532, 8432781.00917312, 4547223.73964561, 8432760.28444425, 4547222.21132491))

如何去除多边形中的孔?回到我的第一个几何体

1 个答案:

答案 0 :(得分:1)

使用sdo_util.extract获取第一个元素的第一个环。

select sdo_util.extract(mdsys.sdo_geometry(2003
                                          ,2400000
                                          ,null
                                          ,mdsys.sdo_elem_info_array(1, 1003, 1, 11, 2003, 1)
                                          ,mdsys.sdo_ordinate_array(8432760.2844442501664161682128906250
                                                                   ,4547222.211324909701943397521972656250
                                                                   ,8432767.404376400634646415710449218750
                                                                   ,4547207.649308839812874794006347656250
                                                                   ,8432787.325771750882267951965332031250
                                                                   ,4547207.513505320064723491668701171875
                                                                   ,8432781.009173119440674781799316406250
                                                                   ,4547223.739645609632134437561035156250
                                                                   ,8432760.2844442501664161682128906250
                                                                   ,4547222.211324909701943397521972656250
                                                                   ,8432777.8091080002486705780029296875
                                                                   ,4547210.60657539963722229003906250
                                                                   ,8432768.0091079995036125183105468750
                                                                   ,4547215.702575399540364742279052734375
                                                                   ,8432777.9211079999804496765136718750
                                                                   ,4547219.79057539999485015869140625
                                                                   ,8432777.8091080002486705780029296875
                                                                   ,4547210.60657539963722229003906250))
                       ,1
                       ,1) geometry
  from dual

https://docs.oracle.com/database/121/SPATL/sdo_util-extract.htm#SPATL1228