public static function computeHeading($from, $to) {
        // http://williams.best.vwh.net/avform.htm#Crs
        $fromLat = deg2rad($from['lat']);
        $fromLng = deg2rad($from['lng']);
        $toLat = deg2rad($to['lat']);
        $toLng = deg2rad($to['lng']);
        $dLng = $toLng - $fromLng;
        $heading = atan2(
                sin($dLng) * cos($toLat),
                cos($fromLat) * sin($toLat) - sin($fromLat) * cos($toLat) * cos($dLng));
        
        return MathUtil::wrap(rad2deg($heading), -180, 180);
    }
public static function computeHeading($from, $to) {
        // http://williams.best.vwh.net/avform.htm#Crs
        $fromLat = deg2rad($from['lat']);
        $fromLng = deg2rad($from['lng']);
        $toLat = deg2rad($to['lat']);
        $toLng = deg2rad($to['lng']);
        $dLng = $toLng - $fromLng;
        $heading = atan2(
                sin($dLng) * cos($toLat),
                cos($fromLat) * sin($toLat) - sin($fromLat) * cos($toLat) * cos($dLng));
        
        return MathUtil::wrap(rad2deg($heading), -180, 180);
    }
public static function computeHeading ( $ from , $ to ) { // http://williams.best.vwh.net/avform.htm#Crs $ fromLat = deg2rad ( $ from [ 'lat' ] ) ; $ fromLng = deg2rad ( $ from [ 'lng' ] ) ; $ toLat = deg2rad ( $ to [ 'lat' ] ) ; $ toLng = deg2rad ( $ to [ 'lng' ] ) ; $ dLng = $ toLng - $ fromLng ; $ heading = atan2 ( sin ( $ dLng ) * cos ( $ toLat ) , cos ( $ fromLat ) * sin ( $ toLat ) - sin ( $ fromLat ) * cos ( $ toLat ) * cos ( $ dLng ) ) ; return MathUtil :: wrap ( rad2deg ( $ heading ) , - 180 , 180 ) ; }
Returns the heading from one LatLng to another LatLng. Headings are
expressed in degrees clockwise from North within the range [-180,180).
@return The heading in degrees clockwise from north.
Returns the heading from one LatLng to another LatLng . Headings are expressed in degrees clockwise from North within the range [ - 180 180 ) .