Missing results due to geo proximity formula (store locator)

前端 未结 5 821
一个人的身影
一个人的身影 2021-02-06 08:38

OK - I\'ve been wrestling with this for about 3 months on and off and since I\'ve exhausted every geo proximity formula out there that I\'ve come across and I\'m no closer to ge

5条回答
  •  离开以前
    2021-02-06 09:16

    This is code from a working production system,

    6371.04 * acos(cos(pi()/2-radians(90-wgs84_lat)) * cos(pi()/2-radians(90-$lat)) * cos(radians(wgs84_long)-radians($lon)) + sin(pi()/2-radians(90-wgs84_lat)) * sin(pi()/2-radians(90-$lat))) as distance
    

    Uses a different distance formular, but for a store locator the difference is minimal.

提交回复
热议问题