通过经纬度计算两点距离
2017-10-31 本文已影响0人
REIGE
mysql实现
SELECT
NAME,
ACOS(
SIN(39.754257 * PI() / 180) * SIN(a.latitude * PI() / 180) + COS(39.754257 * PI() / 180) * COS(a.latitude * PI() / 180) * COS(
a.longitude * PI() / 180 - 115.735067 * PI() / 180
)
) * 6371 AS 'distance'
FROM
address a;