Sprawdziłem ten przykład:http://geomidpoint.com/example.html
I napisałem funkcję w PHP, mam nadzieję, że będzie to pomocne...
[edytuj] zapomniałem przekonwertować na radiany do obliczeń, więc dało to inny wynik, więc teraz powinno działać dobrze ...
<?php
function middlepoint($lat1,$lon1,$lat2,$lon2,$lat3,$lon3){
$w1=1095.75;$w2=730.5;$w3=365.25;$tw=$w1+$w2+$w3; //weighting factors
$x1=cos(floatval(deg2rad($lat1)))*cos(floatval(deg2rad($lon1)));$y1=cos(floatval(deg2rad($lat1)))*sin(floatval(deg2rad($lon1)));$z1=sin(floatval(deg2rad($lat1)));$x2=cos(floatval(deg2rad($lat2)))*cos(floatval(deg2rad($lon2)));$y2=cos(floatval(deg2rad($lat2)))*sin(floatval(deg2rad($lon2)));$z2=sin(floatval(deg2rad($lat2)));$x3=cos(floatval(deg2rad($lat3)))*cos(floatval(deg2rad($lon3)));$y3=cos(floatval(deg2rad($lat3)))*sin(floatval(deg2rad($lon3)));$z3=sin(floatval(deg2rad($lat3))); //convert lat/long to cartesian (x,y,z) coordinates
$x = ($x1*$w1+$x2*$w2+$x3*$w3)/$tw;$y=($y1*$w1+$y2*$w2+$y3*$w3)/$tw;$z=($z1*$w1+$z2*$w2+$z3*$w3)/$tw; //Compute combined weighted cartesian coordinates
$lon=atan2($y,$x);$hyp=sqrt(pow($x,2)+pow($y,2));$lat=atan2($z,$hyp); //Convert cartesian coordinate to latitude and longitude for the midpoint
$midpoint[0] = $lon * (180/pi());$midpoint[1] = $lat * (180/pi()); //Convert from radians to degrees
return $midpoint; //return an array(lat,lon);
}
$test = middlepoint(41.040035,28.984026,41.040868,28.985807,41.039136,28.984981);
print_r($test);
?>