public static function calculateNewCoordinates(float $initialLatitude, float $initialLongitude, float $distance, int $bearing)
    {
        $bearing = deg2rad($bearing);
        $latitude = deg2rad($initialLatitude);
        $longitude = deg2rad($initialLongitude);
        $earth = self::EARTH_RADIUS_METERS / 1000;

        $newLatitude = asin(
            sin($latitude) * cos($distance/$earth) +
            cos($latitude) * sin($distance/$earth) * cos($bearing)
        );

        $newLongitude = $longitude + atan2(
                sin($bearing) * sin($distance/$earth) * cos($latitude),
                cos($distance/$earth)-sin($latitude)*sin($newLatitude)
            );

        return [rad2deg($newLatitude), rad2deg($newLongitude)];
    }
public static function calculateNewCoordinates(float $initialLatitude, float $initialLongitude, float $distance, int $bearing)
    {
        $bearing = deg2rad($bearing);
        $latitude = deg2rad($initialLatitude);
        $longitude = deg2rad($initialLongitude);
        $earth = self::EARTH_RADIUS_METERS / 1000;

        $newLatitude = asin(
            sin($latitude) * cos($distance/$earth) +
            cos($latitude) * sin($distance/$earth) * cos($bearing)
        );

        $newLongitude = $longitude + atan2(
                sin($bearing) * sin($distance/$earth) * cos($latitude),
                cos($distance/$earth)-sin($latitude)*sin($newLatitude)
            );

        return [rad2deg($newLatitude), rad2deg($newLongitude)];
    }
public static function calculateNewCoordinates ( float $ initialLatitude , float $ initialLongitude , float $ distance , int $ bearing ) { $ bearing = deg2rad ( $ bearing ) ; $ latitude = deg2rad ( $ initialLatitude ) ; $ longitude = deg2rad ( $ initialLongitude ) ; $ earth = self :: EARTH_RADIUS_METERS / 1000 ; $ newLatitude = asin ( sin ( $ latitude ) * cos ( $ distance / $ earth ) + cos ( $ latitude ) * sin ( $ distance / $ earth ) * cos ( $ bearing ) ) ; $ newLongitude = $ longitude + atan2 ( sin ( $ bearing ) * sin ( $ distance / $ earth ) * cos ( $ latitude ) , cos ( $ distance / $ earth ) - sin ( $ latitude ) * sin ( $ newLatitude ) ) ; return [ rad2deg ( $ newLatitude ) , rad2deg ( $ newLongitude ) ] ; }
Calculate new coordinates based on distance and bearing

@param float $initialLatitude
@param float $initialLongitude
@param float $distance
@param int $bearing

@return array
Calculate new coordinates based on distance and bearing