0

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

任何帮助将不胜感激。谢谢!

4

1 回答 1

0

事实证明,这是由 Oracle 的限制造成的,即任何多边形都不能大于地球表面的 1/2。要进行搜索,必须将区域分成更小的部分并在最后合并它们

于 2013-07-10T19:14:54.207 回答