def coords_down_bearing(lat, lon, bearing, distance, body):
'''
Takes a latitude, longitude and bearing in degrees, and a
distance in meters over a given body. Returns a tuple
(latitude, longitude) of the point you've calculated.
'''
bearing = math.radians(bearing)
R = body.equatorial_radius
lat = math.radians(lat)
lon = math.radians(lon)
lat2 = math.asin( math.sin(lat)*math.cos(distance/R) +
math.cos(lat)*math.sin(distance/R)*math.cos(bearing))
lon2 = lon + math.atan2(math.sin(bearing)*math.sin(distance/R
)*math.cos(lat),math.cos(distance/R)-math.sin(lat
)*math.sin(lat2))
lat2 = math.degrees(lat2)
lon2 = math.degrees(lon2)
return (lat2, lon2)
评论列表
文章目录