Example #1
0
    def direct(self,
               lat_a,
               lon_a,
               azimuth,
               distance,
               z=0,
               long_unroll=False,
               degrees=False):
        """
        Return position B computed from position A, distance and azimuth.

        Parameters
        ----------
        lat_a, lon_a:  real scalars
            Latitude and longitude [rad or deg] of position a.
        azimuth_a:
            azimuth [rad or deg] of line at position A.
        distance: real scalar
            ellipsoidal distance [m] between position A and B.
        z : real scalar
            depth relative to Earth ellipsoid.
        degrees: bool
            angles are given in degrees if True otherwise in radians.

        Returns
        -------
        lat_b, lon_b:  real scalars
            Latitude and longitude of position b.
        azimuth_b
            azimuth [rad or deg] of line at position B.

        References
        ----------
        C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87(1), 43-55

        `geographiclib <https://pypi.python.org/pypi/geographiclib>`_
        """

        geo = _Geodesic(self.a - z, self.f)
        outmask = _Geodesic.STANDARD
        if long_unroll:
            outmask = _Geodesic.STANDARD | _Geodesic.LONG_UNROLL
        if not degrees:
            lat_a, lon_a, azimuth = deg((lat_a, lon_a, azimuth))
        result = geo.Direct(lat_a, lon_a, azimuth, distance, outmask=outmask)
        latb, lonb, azimuth_b = result['lat2'], result['lon2'], result['azi2']
        if not degrees:
            return rad(latb), rad(lonb), rad(azimuth_b)
        return latb, lonb, azimuth_b
Example #2
0
    def inverse(self,
                lat_a,
                lon_a,
                lat_b,
                lon_b,
                z=0,
                long_unroll=False,
                degrees=False):
        """
        Return ellipsoidal distance between positions as well as the direction.

        Parameters
        ----------
        lat_a, lon_a:  real scalars
            Latitude and longitude of position a.
        lat_b, lon_b:  real scalars
            Latitude and longitude of position b.
        z : real scalar
            depth relative to Earth ellipsoid.
        degrees: bool
            angles are given in degrees if True otherwise in radians.

        Returns
        -------
        s_ab: real scalar
            ellipsoidal distance [m] between position A and B.
        azimuth_a, azimuth_b
            direction [rad or deg] of line at position A and B relative to
            North, respectively.

        References
        ----------
        C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87(1), 43-55

        `geographiclib <https://pypi.python.org/pypi/geographiclib>`_

        """

        outmask = _Geodesic.STANDARD
        if long_unroll:
            outmask = _Geodesic.STANDARD | _Geodesic.LONG_UNROLL

        geo = _Geodesic(self.a - z, self.f)
        if not degrees:
            lat_a, lon_a, lat_b, lon_b = deg((lat_a, lon_a, lat_b, lon_b))
        result = geo.Inverse(lat_a, lon_a, lat_b, lon_b, outmask=outmask)
        azimuth_a = result['azi1'] if degrees else rad(result['azi1'])
        azimuth_b = result['azi2'] if degrees else rad(result['azi2'])
        return result['s12'], azimuth_a, azimuth_b
Example #3
0
    def direct(self, lat_a, lon_a, azimuth, distance, z=0, long_unroll=False,
               degrees=False):
        """
        Return position B computed from position A, distance and azimuth.

        Parameters
        ----------
        lat_a, lon_a:  real scalars
            Latitude and longitude [rad or deg] of position a.
        azimuth_a:
            azimuth [rad or deg] of line at position A.
        distance: real scalar
            ellipsoidal distance [m] between position A and B.
        z : real scalar
            depth relative to Earth ellipsoid.
        degrees: bool
            angles are given in degrees if True otherwise in radians.

        Returns
        -------
        lat_b, lon_b:  real scalars
            Latitude and longitude of position b.
        azimuth_b
            azimuth [rad or deg] of line at position B.

        References
        ----------
        C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87(1), 43-55

        `geographiclib <https://pypi.python.org/pypi/geographiclib>`_
        """

        geo = _Geodesic(self.a-z, self.f)
        outmask = _Geodesic.STANDARD
        if long_unroll:
            outmask = _Geodesic.STANDARD | _Geodesic.LONG_UNROLL
        if not degrees:
            lat_a, lon_a, azimuth = deg((lat_a, lon_a, azimuth))
        result = geo.Direct(lat_a, lon_a, azimuth, distance, outmask=outmask)
        latb, lonb, azimuth_b = result['lat2'], result['lon2'], result['azi2']
        if not degrees:
            return rad(latb), rad(lonb), rad(azimuth_b)
        return latb, lonb, azimuth_b
Example #4
0
    def inverse(self, lat_a, lon_a, lat_b, lon_b, z=0, long_unroll=False,
                degrees=False):
        """
        Return ellipsoidal distance between positions as well as the direction.

        Parameters
        ----------
        lat_a, lon_a:  real scalars
            Latitude and longitude of position a.
        lat_b, lon_b:  real scalars
            Latitude and longitude of position b.
        z : real scalar
            depth relative to Earth ellipsoid.
        degrees: bool
            angles are given in degrees if True otherwise in radians.

        Returns
        -------
        s_ab: real scalar
            ellipsoidal distance [m] between position A and B.
        azimuth_a, azimuth_b
            direction [rad or deg] of line at position A and B relative to
            North, respectively.

        References
        ----------
        C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87(1), 43-55

        `geographiclib <https://pypi.python.org/pypi/geographiclib>`_

        """

        outmask = _Geodesic.STANDARD
        if long_unroll:
            outmask = _Geodesic.STANDARD | _Geodesic.LONG_UNROLL

        geo = _Geodesic(self.a-z, self.f)
        if not degrees:
            lat_a, lon_a, lat_b, lon_b = deg((lat_a, lon_a, lat_b, lon_b))
        result = geo.Inverse(lat_a, lon_a, lat_b, lon_b, outmask=outmask)
        azimuth_a = result['azi1'] if degrees else rad(result['azi1'])
        azimuth_b = result['azi2'] if degrees else rad(result['azi2'])
        return result['s12'], azimuth_a, azimuth_b