class GeoCoordSystem {
protected
$_radius = 6378137,
$_equator = 40075016.68557849,
$_e = array( 0.0818191908426, 0.00669437999014 )
;
public function __construct() {}
public function getDistance( $a, $b ) {
$r = 0.017453293;
$x = $a[1] * $r;
$y = $b[1] * $r;
$l = $this->_radius * sqrt( ( 1 - $this->_e[0] ) / ( 1 - $this->_e[1] * pow( cos( ( $x + $y ) / 2 ), 2 ) ) );
return $l * acos( sin($x) * sin($y) + cos($x) * cos($y) * cos( ( $b[0] - $a[0] ) * $r ) );
}
}