根据经纬度获取最近的地点
select * from *** where ***order by ACOS(SIN(($latitude * 3.1415) / 180 ) *SIN((lat * 3.1415) / 180 ) +COS(($latitude * 3.1415) / 180 ) * COS((lat * 3.1415) / 180 ) *COS(($longitude * 3.1415) / 180 -
·
select * from *** where ***
order by ACOS(SIN(($latitude * 3.1415) / 180 ) *SIN((lat * 3.1415) / 180 ) +COS(($latitude * 3.1415) / 180 ) * COS((lat * 3.1415) / 180 ) *COS(($longitude * 3.1415) / 180 - (lon * 3.1415) / 180 ) ) * 6380
limit 0, 1
其中$latitude 和 $longitude 为传入的经纬度
lat 和 lon 为数据库中保存的经纬度
更多推荐
已为社区贡献1条内容
所有评论(0)