library geo-distance
Find distance between two points on earth. Find closest metro area.
naveed125/geo-distance
Find distance between two points on earth. Find closest metro area.
- Monday, June 5, 2017
- by naveed125
- Repository
- 1 Watchers
- 1 Stars
- 11 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 2 Versions
- 10 % Grown
Geo Distance
Calculate distance between two points on earth using longitude and longitude. Can be used to find out the closest metro area based on distance., (*1)
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