Oracle spatial 周边查询SQL

查询距某一点某一距离的所有要素(即我们通常说的周边查询)sql:

select t.objectid,t.comp_type,t.datatype,t.comp_name,t.health_lic,t.shape.SDO_POINT.X as x,t.shape.SDO_POINT.Y as y,t.reg_addr,t.bus_addr from t_publicplaces t where 1=1 and substr(t.comp_type,0,2)='01' and sdo_within_distance(t.SHAPE,SDO_GEOMETRY(2001,8307,SDO_POINT_TYPE(116.4,39.9,NULL),NULL,NULL),'distance=1500.0 unit=m')='TRUE'

//其中sdo_within_distance是oracle  spatial空间查询   这个函数的具体参数与用法可以到oracle官网上去搜索

posted @ 2012-10-18 20:43  李克华  阅读(1476)  评论(0编辑  收藏  举报