I'm looking at the formula listed here: http://www.movable-type.co.uk/scripts/latlong.html
I seem to be having trouble as the resulting coordinates are not what I would expect them to be.
Given the following information:
Start lat: 28.455556
Start lon: -80.527778
Bearing: 317.662819(Degrees)
Distance: 130.224835(Nautical miles)
def getEndpoint(lat1,lon1,bearing,d):
R = 6378.1 #Radius of the Earth
brng = math.radians(bearing) #convert degrees to radians
d = d*1.852 #convert nautical miles to km
lat2 = math.asin( math.sin(lat1)*math.cos(d/R) + math.cos(lat1)*math.sin(d/R)*math.cos(brng))
lon2 = lon1 + math.atan2(math.sin(brng)*math.sin(d/R)*math.cos(lat1),math.cos(d/R)-math.sin(lat1)*math.sin(lat2))
return lat2,lon2
The function returns:
end lat: -0.209110644042
end lon: -80.5017472335
But this is a coordinate east of my beginning location, it doesn't make any sense because 317 bearing is pointing north-west of my starting location.
Above picture is what It should look like with the final ending coordinate on the upper left.
Where is it going wrong?