Answers for "how to find nearest location using latitude and longitude in php"

SQL
0

how to calculate nearest location using longitude and latitude

SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < 25 ORDER BY distance LIMIT 0 , 20;
Posted by: Guest on November-03-2020
0

php get closest location by latitude longitude

SELECT * , (3956 * 2 * ASIN(SQRT( POWER(SIN(( $lat - LatOnTable) *  pi()/180 / 2), 2) +COS( $lat * pi()/180) * COS(LatOnTable * pi()/180) * POWER(SIN(( $long - LongOnTable) * pi()/180 / 2), 2) ))) as distance  
from yourTable  
having  distance <= 10 
order by distance
Posted by: Guest on August-31-2021

Code answers related to "how to find nearest location using latitude and longitude in php"

Code answers related to "SQL"

Browse Popular Code Answers by Language