How to use the geographiclib.geodesic.Geodesic.WGS84 function in geographiclib

To help you get started, we’ve selected a few geographiclib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sagost / Video_UAV_Tracker-3D / Video_UAV_Tracker / QGisMap.py View on Github external
Azimuth =   Calculus['azi2']                 
                        SpeedMeterSecond = DistanceBetweenPoint             #GPS refresh rate is actually 1, change parameter for different rates
                       # Time = 1                                            
                        if RemainToUseMeterTotal == 0:
                            if DistanceBetweenPoint >= meters:
                                decimalSecondToAdd = meters / DistanceBetweenPoint
                                RemainToUseMeter = DistanceBetweenPoint - meters
                                if os.name == 'nt':
                                    t = threading.Thread(target= extract,args=(ffmpeg,i,decimalSecondToAdd,self.videoFile,Directory))
                                    t.start()
                                    
                                else:
                                    os.system(ffmpeg+ ' -ss '+ str(i + decimalSecondToAdd) +
                                              ' -i '+ str(self.videoFile) + ' -frames:v 1 ' + Directory + '_sec_' + str(i) + str(decimalSecondToAdd)[1:4] +'.png')
                                
                                CalculusDirect = Geodesic.WGS84.Direct(latitude1, longitude1, Azimuth,decimalSecondToAdd* SpeedMeterSecond) 
                                X,Y,quotainutile = self.transform_wgs84_to_utm(CalculusDirect['lon2'],CalculusDirect['lat2'] )  
                                Z = ele1 + decimalSecondToAdd*(ele2 - ele1)
                                txtGPSFile.write(str(Directory.split('/')[-1]) + '_sec_'  + str(i) + str(decimalSecondToAdd)[1:4]+'.png,' + ' ' + str(X) + ', ' + str(Y) + ', ' + str(Z) + '\n')
                                while RemainToUseMeter > meters:
                                    decimalSecondToAddMore = meters / SpeedMeterSecond
                                    RemainToUseMeter = RemainToUseMeter - meters
                                    decimalSecondToAdd = decimalSecondToAdd + decimalSecondToAddMore
                                    if os.name == 'nt':
                                        os.popen(ffmpeg + ' -ss '+ str(i + decimalSecondToAdd) +
                                             ' -i '+ str('"'+self.videoFile+'"') + ' -frames:v 1 ' +'"'+ Directory + '_sec_' + str(i) + str(decimalSecondToAdd)[1:4] +'.png'+'"')
                                    else:
                                        os.system(ffmpeg+ ' -ss '+ str(i + decimalSecondToAdd) +
                                                  ' -i '+ str(self.videoFile) + ' -frames:v 1 ' + Directory + '_sec_' + str(i) + str(decimalSecondToAdd)[1:4] +'.png')
                                    
                                    CalculusDirect = Geodesic.WGS84.Direct(latitude1, longitude1, Azimuth,decimalSecondToAdd* SpeedMeterSecond) 
                                    X,Y,quotainutile = self.transform_wgs84_to_utm(CalculusDirect['lon2'],CalculusDirect['lat2'] )
github ron1818 / Singaboat_RobotX2016 / robotx_bringup / nodes / map_to_odom_broadcaster.py View on Github external
def __init__(self, nodename, map_lat, map_lon, rotation):
        rospy.init_node(nodename)
        map_lat = rospy.get_param("~map_lat", map_lat)
        map_lon = rospy.get_param("~map_lon", map_lon)
        rotation = rospy.get_param("~rotation", rotation)
        rate = rospy.Rate(10)
        br = tf.TransformBroadcaster()
        rospy.wait_for_message("navsat/fix", NavSatFix)
        rospy.Subscriber("navsat/fix", NavSatFix, self.navsat_fix_callback, queue_size=10)
        rospy.sleep(10)
        print map_lat, map_lon
        print self.lat0, self.lon0
        initial_gps = [self.lat0, self.lon0]

        result = Geodesic.WGS84.Inverse(map_lat, map_lon, self.lat0, self.lon0)
        r = result['s12']
        azi = result['azi1'] * pi /180.0
        theta = pi / 2 - azi

        xyz = [r * cos(theta), r * sin(theta), 0]
        print xyz
        rpy = [0, 0, rotation]

        while not rospy.is_shutdown():
            self.tf_link(br, "map", "odom", xyz, rpy)
            rate.sleep()
github echolite / ANTS / KERNELS / gc_visual.py View on Github external
def gc_example():
    p=geodesic.Geodesic.WGS84.Inverse(40.6, -73.8, 1.4, 104)
    l=geodesic.Geodesic.WGS84.Line(p['lat1'],p['lon1'],p['azi1'])
    num=15
    for i in range(num+1):
      b=l.Position(i*p['s12']/num)
github sagost / Video_UAV_Tracker-3D / Video_UAV_Tracker / NewProject.py View on Github external
Pitch = -(360-Pitch)
                    Roll = Roll + self.RollOffset
                    if Roll < -180:
                        Roll = 360 - abs(Roll)
                    elif Roll > 180:
                        Roll = -(360-Roll)

                Ele = x[1][2]
                Time = x[1][3]
                Counter = Counter + 1
            else:
                ActualLatitude = x[1][0]
                ActualLongitude = x[1][1]
                PreviousLatitude = GpxPartition[Counter+1][1][0]
                PreviousLongitude = GpxPartition[Counter+1][1][1]
                GeodesicCalcolus = Geodesic.WGS84.Inverse(ActualLatitude, ActualLongitude, PreviousLatitude, PreviousLongitude)
                Speed = GeodesicCalcolus['s12'] * 1
                if self.Course == 1:
                    Course = float(x[1][4])
                    Pitch = float(x[1][5])
                    Roll = float(x[1][6])
                else:
                    Course = GeodesicCalcolus['azi2']
                    if Course < 0:
                        Course += 360
                    Pitch = 0
                    Roll = 0
                if self.GPXMode == 1:      # correct value with fixed offset
                    Course = Course + self.HeadingOffset
                    if Course > 360:
                        Course = Course -360
                    elif Course < 0:
github stephen-hocking / ads-b-logger / PlaneReport.py View on Github external
def geodistance(lon1, lat1, lon2, lat2):
    geod = Geodesic.WGS84

    g = geod.Inverse(lat1, lon1, lat2, lon2)
    return g['s12']
github nismod / digital_comms / digital_comms / mobile_network / transmitter_module.py View on Github external
#calculate interference from other power sources
        for interference_site in closest_sites:

            #get distance
            x2_interference = interference_site.coordinates[0]
            y2_interference = interference_site.coordinates[1]

            x2_interference, y2_interference = transform_coordinates(
                Proj(init='epsg:27700'),
                Proj(init='epsg:4326'),
                interference_site.coordinates[0],
                interference_site.coordinates[1]
                )

            Geo = Geodesic.WGS84

            i_strt_distance = Geo.Inverse(
                y2_interference,
                x2_interference,
                y1_receiver,
                x1_receiver,
                )

            interference_strt_distance = int(
                round(i_strt_distance['s12'], 0)
                )

            ant_height = 20
            ant_type =  'macro'
            building_height = 20
            street_width = 20
github JamesLMilner / Loxo / loxoutils.py View on Github external
def get_WGS84_distance( lat1, lon1, lat2, lon2 ):
    return Geodesic.WGS84.Inverse(lat1, lon1, lat2, lon2, Geodesic.DISTANCE)[GEO_DIST]
github UCL-ShippingGroup / pyrate / pyrate / utils.py View on Github external
Returns
    -------
    timediff : datetime
        The difference in time between the two messages in datetime
    dist : float
        The distance between messages in nautical miles
    speed : float
        The speed in knots
    """
    timediff = abs(msg_stream[index2]['Time'] - msg_stream[index1]['Time'])
    try:
        dist = distance((msg_stream[index1]['Latitude'], msg_stream[index1]['Longitude']),\
                       (msg_stream[index2]['Latitude'], msg_stream[index2]['Longitude'])).m
    except ValueError:
        dist = Geodesic.WGS84.Inverse(msg_stream[index1]['Latitude'], msg_stream[index1]['Longitude'],\
                       msg_stream[index2]['Latitude'], msg_stream[index2]['Longitude'])['s12'] #in metres
    if timediff > datetime.timedelta(0):
        convert_metres_to_nautical_miles = 0.0005399568
        speed = (dist * convert_metres_to_nautical_miles) / (timediff.days * 24 + timediff.seconds / 3600)
    else:
        speed = 102.2
    return timediff, dist, speed