This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inputs in Radians so degtorad degrees first. | |
function vincenty($lat1, $lon1, $lat2, $lon2) { | |
// Equitorial Radius | |
$a = 6378137.0; | |
// Polar Radius | |
$b = 6356752.31424518; | |
//Flattening of the ellipsoid | |
$f = 0.00335281066; | |
// Difference in longitude | |
$L = $lon2 - $lon1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Calculate geodesic distance (in meters) between two points specified by | |
* latitude/longitude using Vincenty inverse formula for ellipsoids | |
* | |
* from: Vincenty inverse formula - T Vincenty, "Direct and Inverse | |
* Solutions of Geodesics on the Ellipsoid with application of nested | |
* equations", Survey Review, vol XXII no 176, 1975 | |
* http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf | |
* |