Ben bu PHP işlevi var, ama yanlış sonuçlar verebilir gibi görünüyor. Herkes onun (esp formülü) ile yanlış bir fikir var mı?
/**
* Finds a destination given a starting location, bearing and distance.
*
* @param array $startingCoordinates The starting coordinates, as non-directional floats in an array with lat and lon keys.
* @param float $bearing The initial bearing in degrees.
* @param float $distance The distance to travel in km.
*
* @return array The desitination coordinates, as non-directional floats in an array with lat and lon keys.
*/
public static function findDestination( array $startingCoordinates, $bearing, $distance ) {
$startingCoordinates['lat'] = (float)$startingCoordinates['lat'];
$startingCoordinates['lon'] = (float)$startingCoordinates['lon'];
$angularDistance = $distance / Maps_EARTH_RADIUS;
$lat = asin(
sin( $startingCoordinates['lat'] ) * cos( $angularDistance ) +
cos( $startingCoordinates['lat'] ) * sin( $angularDistance ) * cos( $bearing )
);
return array(
'lat' => $lat,
'lon' => $startingCoordinates['lon'] + atan2(
sin( $bearing ) * sin( $angularDistance ) * cos( $startingCoordinates['lat'] ),
cos( $angularDistance ) - sin( $startingCoordinates['lat'] ) * sin( $lat )
)
);
}