MySQL 经纬度计算距离

$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";

你可能感兴趣的:(MySQL 经纬度计算距离)