计算两个坐标之间距离的函数

本文探讨了如何使用SQL查询技术优化地理数据查询效率,包括利用地理坐标进行精确匹配和距离计算,以及如何通过数据库索引提升查询性能。重点介绍了sdo_geom.sdo_distance函数在计算两点间距离的应用,并通过实例展示了如何结合GIS数据和百度地图API实现地理位置信息的有效整合。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

select 
address 地址,
county  区,
entertype 类型,
round( sdo_geom.sdo_distance(
sdo_geometry(2001,null,sdo_point_type(t_x,t_y,null),null,null),
sdo_geometry(2001,null,sdo_point_type(t1_x,t1_y,null),null,null),--sdo_geom.sdo_distance函数
0.001),5)*1000  相差距离
from (<pre name="code" class="sql">select t.lnglat.sdo_point.x  t_x,t.lnglat.sdo_point.y t_y,
       t1.bd_lng t1_x,t1.bd_lat t1_y,
       t.address address,
       t2.county county ,
       t2.entertype entertype

from  T_GIS_LNGLATLOG_SHANGHAI t
join t_address_formal t2 on 
t.address=t2.address
join  t_cordinate_baidu t1 on 
t2.address_no=t1.id
)
order by 相差距离 



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值