Oracle Spatial无法找到覆盖整个世界的多边形的交叉点

时间:2013-07-09 16:12:58

标签: sql oracle spatial

我是Oracle Spatial的新手,我正在尝试实现一个服务,该服务将从地图中获取坐标,并搜索我们的数据库以查找与该地图视图相交的任何几何。我在大多数情况下工作正常,但是当我将地图缩小到可以看到整个世界的所有方式时,Oracle搜索根本不会返回任何记录。有人可以看到为什么当我在几何表中有超过20条记录时,以下sql会返回0条记录:

select g.id, g.name, SDO_UTIL.to_kmlgeometry(g.geom) as kml from geography g
where SDO_RELATE(g.geom,
            SDO_GEOMETRY(2003,8307,NULL,SDO_ELEM_INFO_ARRAY(1,1003,1),
                SDO_ORDINATE_ARRAY(
                       -180,-90,
                        180,-90,
                        180,90,
                        -180,90
                )),
            'mask=ANYINTERACT') = 'TRUE';

插入数据库的几个样本记录:

INSERT INTO geography VALUES(
  GEOGRAPHY_ID_SEQ.nextVal,
  'd2',
  SDO_GEOMETRY(
    2003, -- 2d poly
    8307,
    NULL,
    SDO_ELEM_INFO_ARRAY(1,1003,1), -- polygon
    SDO_ORDINATE_ARRAY(-77.01204711074818,38.88772105792418,
                            -77.01200419540395,38.89196328335449,
                            -77.00831347579947,38.89249647861828,
                            -77.00827056045522,38.88768765356904,
                            -77.01204711074818,38.88772105792418)
  )
);

INSERT INTO geography VALUES(
  GEOGRAPHY_ID_SEQ.nextVal,
  'd3',
  SDO_GEOMETRY(
    2003, -- 2d poly
    8307,
    NULL,
    SDO_ELEM_INFO_ARRAY(1,1003,1), -- polygon
    SDO_ORDINATE_ARRAY(-77.05552889816111,38.86892085934577,
        -77.05329022237119,38.87065233921285,
        -77.05467677541158,38.87288138804671,
        -77.05786820241124,38.87248696633578,
        -77.05840989692072,38.87006762135151,
        -77.05552889816111,38.86892085934577)
  )
);

非常感谢任何帮助。谢谢!

1 个答案:

答案 0 :(得分:0)

事实证明这是由甲骨文的极限造成的,其中没有多边形可以大于地球表面的1/2。要进行搜索,必须将区域分成更小的部分并在最后将它们结合起来