MySQL 经纬度计算距离

2020-11-16  本文已影响0人  矛盾迩

$long = $info["content"]["point"]["x"];

$lat = $info["content"]["point"]["y"];

$juli = "ROUND(6378.137 * 2 * ASIN(SQRT(POW(SIN(({$lat}*PI()/180-`latitude`*PI()/180)/2),2)+COS({$lat}*PI()/180)*COS(`latitude`*PI()/180)*POW(SIN(({$long}*PI()/180-`longitude`*PI()/180)/2),2)))*1000) AS juli";

$sql="SELECT *,".$juli." FROM ".$ecs->table("supplier")." ORDER BY juli asc";

上一篇下一篇

猜你喜欢

热点阅读