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.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.