0

Trying to get two gps coordinate bearing in degree, but get wrong result. I think the problem is python math work in radiant, but when a convert to degrees got wrong result too.

The good result is around 30-33. With this code, i get 0,75, when converting rad to deg, get 43. There is my code:

import math

lat1 = 47.357818 
lon1 = 18.985417
lat2 = 47.369282 
lon2 = 18.996625
pi = 3.1415

X = math.cos(lat2) * math.sin(lon1-lon2)
Y = math.cos(lat1) * math.sin(lat2) - math.sin(lat1) * math.cos(lat2) * math.cos(lon2-lon1)
B = math.atan2(X,Y)

print B

Help me please, what is the good method to convert? ps: Sorry for my english.

imi79
  • 9
  • 1

0 Answers0