Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- a_n_s = input(str('Is waypoint 1 N or S Latitude: '))
- if a_n_s.lower() == 'n':
- a_n_s = 1
- else:
- a_n_s = -1
- a_e_w = input(str('Is waypoint 1 E or W Longitude: '))
- if a_e_w.lower() == 'e':
- a_e_w = -1
- else:
- a_e_w = 1
- waypoint_a_lat_deg = float(input('Waypoint 1 Latitude Degrees: '))
- waypoint_a_lat_min = float(input('Waypoint 1 Latitude decimal Minutes: '))
- waypoint_a_lat = waypoint_a_lat_deg + (waypoint_a_lat_min / 60)
- waypoint_a_lon_deg = float(input('Waypoint 1 Longitude Degrees: '))
- waypoint_a_lon_min = float(input('Waypoint 1 Longitude decimal Minutes: '))
- waypoint_a_lon = waypoint_a_lon_deg + (waypoint_a_lon_min / 60)
- b_n_s = input(str('Is waypoint 2 N or S Latitude: '))
- if b_n_s.lower() == 'n':
- b_n_s = 1
- else:
- b_n_s = -1
- b_e_w = input(str('Is waypoint 2 E or W Longitude: '))
- if b_e_w.lower() == 'e':
- b_e_w = -1
- else:
- b_e_w = 1
- waypoint_b_lat_deg = float(input('Waypoint 2 Latitude Degrees: '))
- waypoint_b_lat_min = float(input('Waypoint 2 Latitude decimal Minutes: '))
- waypoint_b_lat = waypoint_b_lat_deg + (waypoint_b_lat_min / 60)
- waypoint_b_lon_deg = float(input('Waypoint 2 Longitude Degrees: '))
- waypoint_b_lon_min = float(input('Waypoint 2 Longitude decimal Minutes: '))
- waypoint_b_lon = waypoint_b_lon_deg + (waypoint_b_lon_min / 60)
- lat1 = math.radians(waypoint_a_lat_deg) * a_n_s #USE THIS FOR THE SPHERICAL CALCULATIONS
- lon1 = math.radians(waypoint_a_lon_deg) * a_e_w #USE THIS FOR THE SPHERICAL CALCULATIONS
- lat2 = math.radians(waypoint_b_lat_deg) * b_n_s #USE THIS FOR THE SPHERICAL CALCULATIONS
- lon2 = math.radians(waypoint_b_lon_deg) * b_e_w #USE THIS FOR THE SPHERICAL CALCULATIONS
- print('waypoint a lat: ' + str(waypoint_a_lat) + str(type(waypoint_a_lat)))
- print('waypoint a lon: ' + str(waypoint_a_lon) + str(type(waypoint_a_lon)))
- print('waypoint b lat: ' + str(waypoint_b_lat) + str(type(waypoint_b_lat)))
- print('waypoint b lon: ' + str(waypoint_b_lon) + str(type(waypoint_b_lon)))
- print('lat1: ' + str(lat1) + str(type(lat1)))
- print('lon1: ' + str(lon1) + str(type(lon1)))
- print('lat2: ' + str(lat2) + str(type(lat2)))
- print('lon2: ' + str(lon2) + str(type(lon2)))
- true_crs = math.atan2((math.sin(lon1 - lon2) * math.cos(lat2)),(math.cos(lat1) * math.sin(lat2)) - (math.sin(lat1) * math.cos(lat2) * math.cos(lon1 - lon2))) % (math.pi * 2)
- print(str(math.degrees(true_crs)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement