SQL脚本
思路:计算经纬度之间球面距离,返回单位:米
6378137*2*ASIN(SQRT(POWER(SIN((destination_lat-endpoint_lat)*ACOS(-1)/360),2) +COS(destination_lat*ACOS(-1)/180)*COS(endpoint_lat*ACOS(-1)/180) *POWER(SIN((destination_lon-endpoint_lon)*ACOS(-1)/360),2)))
SQL案例:
select 6378137*2*ASIN(SQRT(POWER(SIN((121.110115-121.115115)*ACOS(-1)/360),2) +COS(121.110115*ACOS(-1)/180)*COS(121.115115*ACOS(-1)/180) *POWER(SIN((31.11342-31.11342)*ACOS(-1)/360),2))) as z_distance
原文地址:https://www.cnblogs.com/Christbao/p/12429534.html
时间: 2024-10-21 14:26:06