How to find nearest location using latitude and longitude from SQL database?

前端 未结 7 1440
离开以前
离开以前 2020-11-30 17:41

I want to find a nearest location from following database table

Address                            Latitude                longitude 

Kathmandu 44600, Nepal          


        
7条回答
  •  情话喂你
    2020-11-30 18:01

    sesach : ( 3959 * acos( cos( radians('.$_REQUEST['latitude'].') ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians('.$_REQUEST['longitude'].') ) + sin( radians('.$_REQUEST['latitude'].') ) * sin( radians( latitude ) ) ) ) <='.$_REQUEST['mile'];
    

提交回复
热议问题