naveed125/geo-distance

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

Installs: 23

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/naveed125/geo-distance

1.0.2 2017-06-05 06:11 UTC

This package is not auto-updated.

Last update: 2025-09-27 04:35:31 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