Explorar el Código

Creation d'un algo de test (distance et oriantation entre 2 point GPS)

remy hace 3 años
padre
commit
8966a3aede
Se han modificado 1 ficheros con 27 adiciones y 0 borrados
  1. 27 0
      Soft/gps.py

+ 27 - 0
Soft/gps.py

@@ -0,0 +1,27 @@
+#http://instantglobe.com/CRANES/GeoCoordTool.html
+
+import math
+
+R = 6371
+PI = 3.141592
+tc1 = 0
+
+lat2 = 44.909916*(PI/180)
+lon2 = 4.847728*(PI/180)
+lat1 = 45.178890*(PI/180)
+lon1 = 5.708217*(PI/180)
+
+drad = math.acos(math.sin(lat1)*math.sin(lat2) + math.cos(lat1)*math.cos(lat2)*math.cos(-lon1+lon2))
+
+dist = drad * R
+
+if math.sin(-lon2+lon1)<0 :
+	tc1=math.acos((math.sin(lat2)-math.sin(lat1)*math.cos(drad))/(math.sin(drad)*math.cos(lat1)))
+else : 
+	tc1=2*3.1415-math.acos((math.sin(lat2)-math.sin(lat1)*math.cos(drad))/(math.sin(drad)*math.cos(lat1)))
+
+print(tc1*(180/PI),dist)
+
+
+#dist 73.9248
+#angle 65.83°deg