Distance of two Geo-Points in PHP & Python

I needed to calculate the distance between two Geo-Points using PHP.

Using Haversine formula you get to this function, where you enter lat1, long1, lat2, long2 and it will give the distance in Km.

In case you want to show the distance in Miles, simply change the Earth radius to 3956.

PHP:

Python

Hope it helps someone!

Leave a Reply

Your email address will not be published. Required fields are marked *