def gps_newpos(lat, lon, bearing, distance):
 lat1 = math.radians(lat)
 lon1 = math.radians(lon)
 brng = math.radians(bearing)
 dr = (distance / radius_of_earth)
 lat2 = math.asin(((math.sin(lat1) * math.cos(dr)) + ((math.cos(lat1) * math.sin(dr)) * math.cos(brng))))
 lon2 = (lon1 + math.atan2(((math.sin(brng) * math.sin(dr)) * math.cos(lat1)), (math.cos(dr) - (math.sin(lat1) * math.sin(lat2)))))
 return (math.degrees(lat2), wrap_valid_longitude(math.degrees(lon2)))

def gps_newpos ( lat , lon , bearing , distance ) : lat1 = math . radians ( lat ) lon1 = math . radians ( lon ) brng = math . radians ( bearing ) dr = ( distance / radius_of_earth ) lat2 = math . asin ( ( ( math . sin ( lat1 ) * math . cos ( dr ) ) + ( ( math . cos ( lat1 ) * math . sin ( dr ) ) * math . cos ( brng ) ) ) ) lon2 = ( lon1 + math . atan2 ( ( ( math . sin ( brng ) * math . sin ( dr ) ) * math . cos ( lat1 ) ) , ( math . cos ( dr ) - ( math . sin ( lat1 ) * math . sin ( lat2 ) ) ) ) ) return ( math . degrees ( lat2 ) , wrap_valid_longitude ( math . degrees ( lon2 ) ) )
extrapolate latitude/longitude given a heading and distance thanks to URL .