예제 #1
0
    def great_distance(self, **kwargs):
        """
            Named arguments:
            start_point = Location4D obect representing start point
            end_point = Location4D obect representing end point
            rmajor = radius of earth's major axis. default=6378137.0 (WGS84)
            rminor = radius of earth's minor axis. default=6356752.3142 (WGS84)

            Returns a dictionaty with:
            'distance' in meters
            'azimuth' in decimal degrees
            'reverse_azimuth' in decimal degrees

        """

        start_point = kwargs.pop('start_point', None)
        end_point = kwargs.pop('end_point', None)
        if start_point == None and end_point == None:
            start_lat = kwargs.pop("start_lats")
            start_lon = kwargs.pop("start_lons")
            end_lat = kwargs.pop("end_lats")
            end_lon = kwargs.pop("end_lons")
        rmajor = kwargs.pop('rmajor', 6378137.0)
        rminor = kwargs.pop('rminor', 6356752.3142)
        f = (rmajor - rminor) / rmajor

        if start_point != None and end_point != None:
            distance, angle, reverse_angle = GreatCircle.vinc_dist(
                f, rmajor, math.radians(start_point.latitude),
                math.radians(start_point.longitude),
                math.radians(end_point.latitude),
                math.radians(end_point.longitude))
        else:
            vector_dist = np.vectorize(GreatCircle.vinc_dist)
            distance, angle, reverse_angle = vector_dist(
                f, rmajor, np.radians(start_lat), np.radians(start_lon),
                np.radians(end_lat), np.radians(end_lon))
        return {
            'distance': distance,
            'azimuth': np.degrees(angle),
            'reverse_azimuth': np.degrees(reverse_angle)
        }
예제 #2
0
    def great_distance(self, **kwargs):
        """
            Named arguments:
            start_point = Location4D obect representing start point
            end_point = Location4D obect representing end point
            rmajor = radius of earth's major axis. default=6378137.0 (WGS84)
            rminor = radius of earth's minor axis. default=6356752.3142 (WGS84)

            Returns a dictionaty with:
            'distance' in meters
            'azimuth' in decimal degrees
            'reverse_azimuth' in decimal degrees

        """

        start_point = kwargs.pop('start_point', None)
        end_point = kwargs.pop('end_point', None)
        if start_point == None and end_point == None:
            start_lat = kwargs.pop("start_lats")
            start_lon = kwargs.pop("start_lons")
            end_lat = kwargs.pop("end_lats")
            end_lon = kwargs.pop("end_lons")
        rmajor = kwargs.pop('rmajor', 6378137.0)
        rminor = kwargs.pop('rminor', 6356752.3142)
        f = (rmajor - rminor) / rmajor

        if start_point != None and end_point != None:
            distance, angle, reverse_angle = GreatCircle.vinc_dist(f, rmajor, math.radians(start_point.latitude), 
                                                                   math.radians(start_point.longitude), 
                                                                   math.radians(end_point.latitude), 
                                                                   math.radians(end_point.longitude))
        else:
            vector_dist = np.vectorize(GreatCircle.vinc_dist)
            distance, angle, reverse_angle = vector_dist(f, rmajor, np.radians(start_lat), np.radians(start_lon),
                                                         np.radians(end_lat), np.radians(end_lon))
        return {'distance': distance, 'azimuth': np.degrees(angle), 'reverse_azimuth': np.degrees(reverse_angle)}