sql根据两组经纬度算出其距离

来源:互联网 发布:斋藤飞鸟黑历史 知乎 编辑:程序博客网 时间:2024/04/29 23:31

公式为:

2*6378137*ASIN(SQRT(POW(SIN(PI()*(#{latitude ,jdbcType=DECIMAL}-csb.latitude)/360),2)+COS(PI()*#{latitude,jdbcType=DECIMAL}/180)*

COS(csb.latitude*PI()/180)*POW(SIN(PI()*(#{longitude ,jdbcType=DECIMAL}-csb.longitude)/360),2))) as distance,

其中返回值单位为km

0 0
原创粉丝点击