naveed125/geo-distance

Find distance between two points on earth. Find closest metro area.

1.0.2 2017-06-05 06:11 UTC

This package is not auto-updated.

Last update: 2024-12-21 00:52:01 UTC


README

Calculate distance between two points on earth using longitude and longitude. Can be used to find out the closest metro area based on distance.

Example:

// 1 Market St. San Francisco, California, USA
$start = array (
  'lat' => 37.793629,
  'long' => -122.394264
);

// Pier 39, San Francisco, California, USA
$end = array (
  'lat' => 37.808868, 
  'long' => -122.409842
);

$gd = new GeoDistance\GeoDistance();
$distance = $gd->distance($start,$end);

echo "Distance between the two points is: {$distance} miles\n";

The above should output the following:

Distance between the two points is: 1.3532202220106