$sql='select * from users_location where latitude > '.$lat.'-1 and latitude < '.$lat.'+1 and longitude > '.$lon.'-1 and longitude < '.$lon.'+1 order by ACOS(SIN(('.$lat.' * 3.1415) / 180 ) *SIN((latitude * 3.1415) / 180 ) +COS(('.$lat.' * 3.1415) / 180 ) * COS((latitude * 3.1415) / 180 ) *COS(('.$lon.'* 3.1415) / 180 - (longitude * 3.1415) / 180 ) ) * 6380 asc limit 10';

 

 

转载:MySQL在存经纬度的数据库查询最近距离的应用

 

相关文章:

  • 2022-12-23
  • 2021-11-20
  • 2021-09-30
  • 2022-01-31
  • 2022-02-18
  • 2021-11-27
  • 2021-06-02
猜你喜欢
  • 2021-09-25
  • 2022-12-23
  • 2021-12-19
  • 2021-10-26
  • 2021-05-23
  • 2022-12-23
  • 2022-02-14
相关资源
相似解决方案