Using the Haversine formula with PostgreSQL and PDO
By : Christy Haragan
Date : March 29 2020, 07:55 AM
wish helps you PostgreSQL does have a radians function: code :
radians(cast(lat as double precision))
SELECT id, ( 6371 * acos( cos( radians(51.8391) ) * cos( radians( lat ) ) * cos( radians( lng )  radians(4.6265) ) + sin( radians(51.8391) ) * sin( radians( lat ) ) ) ) AS distance
FROM shops
HAVING ( 6371 * acos( cos( radians(51.8391) ) * cos( radians( lat ) ) * cos( radians( lng )  radians(4.6265) ) + sin( radians(51.8391) ) * sin( radians( lat ) ) ) ) < 25
ORDER BY name asc
select id, distance
from (
select id, name, ( 6371 * acos( cos( radians(51.8391) ) * cos( radians( lat ) ) * cos( radians( lng )  radians(4.6265) ) + sin( radians(51.8391) ) * sin( radians( lat ) ) ) ) as distance
from shops
) as dt
where distance < 25.0
order by name asc

Haversine formula with php
By : Gareth
Date : March 29 2020, 07:55 AM

VBA haversine formula
By : Alluri divya teja
Date : March 29 2020, 07:55 AM

Is the Haversine Formula or the Vincenty's Formula better for calculating distance?
By : pop toyz
Date : March 29 2020, 07:55 AM

Haversine formula
By : Gabriel Altemann
Date : March 29 2020, 07:55 AM

