/**
* @param [longitude] [经度]
* @param [latitude] [纬度]
*/
public function getList($where,$page=1,$longitude=0,$latitude=0)
{
$start=($page-1)*10;
$field="ACOS(SIN((".$latitude." * 3.1415) / 180 ) *SIN((latitude * 3.1415) / 180 ) +COS((".$latitude." * 3.1415) / 180 ) * COS((latitude * 3.1415) / 180 ) *COS((".$longitude." * 3.1415) / 180 - (longitude * 3.1415) / 180 ) ) * 6380";
$rs=$this->where($where)->field('id,latitude,longitude,name,address,('.$field.') AS distance')->limit($start,10)->order('distance asc')->select();
return $rs;
}
计算2点之间的距离(经纬度)
最新推荐文章于 2024-05-06 11:03:47 发布