PHP MySQL get locations in radius user's location from GPS

前端 未结 5 1045
轻奢々
轻奢々 2020-12-17 03:27

I have in my database car incidents for example. These incidents have a latitude and longitude. On a mobile using the GPS, I get the user\'s location with his coordinates. T

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-17 03:52

     SELECT 3963 * ACOS(
        SIN(RADIANS($pointAlat)) * SIN(RADIANS($pointAlat)) + COS(RADIANS($pointAlat))  * COS(RADIANS($pointBlat)) * COS(RADIANS($pointAlong) - RADIANS($pointBlong)))
     AS
     distance;
    

    Also, if you're looking for a good read/tutorial on this.. Check here http://www.phpfreaks.com/forums/index.php/topic,208965.0.html

提交回复
热议问题