AppInventor: Menghitung Jarak dan Arah dari GPS: Difference between revisions
From OnnoCenterWiki
Jump to navigationJump to search
Onnowpurbo (talk | contribs) No edit summary |
Onnowpurbo (talk | contribs) |
||
| Line 10: | Line 10: | ||
x = 69.1 * (lat2 - lat1) | x = 69.1 * (lat2 - lat1) | ||
y = 69.1 * (lon2 - lon1) * cos(lat1/57.3) | y = 69.1 * (lon2 - lon1) * cos(lat1/57.3) | ||
==Arah Kiblat== | |||
phiK = 21.4*PI/180.0; | |||
lambdaK = 39.8*PI/180.0; | |||
phi = lat*PI/180.0; | |||
lambda = lon*PI/180.0; | |||
psi = 180.0/PI*Math.atan2(Math.sin(lambdaK-lambda), Math.cos(phi)*Math.tan(phiK)-Math.sin(phi)*Math.cos(lambdaK-lambda)); | |||
return Math.round(psi); | |||
Ref: http://www.islamicsoftware.org/qibla/qibla.html | |||
==Menghitung Arah== | ==Menghitung Arah== | ||
Revision as of 13:34, 10 October 2015
Sumber: https://sites.google.com/site/appinventor/distance-based-on-lat-long
Menghitung Jarak
Jarak:
distance = sqrt(x^2 + y^2)
Dimana:
x = 69.1 * (lat2 - lat1) y = 69.1 * (lon2 - lon1) * cos(lat1/57.3)
Arah Kiblat
phiK = 21.4*PI/180.0; lambdaK = 39.8*PI/180.0; phi = lat*PI/180.0; lambda = lon*PI/180.0; psi = 180.0/PI*Math.atan2(Math.sin(lambdaK-lambda), Math.cos(phi)*Math.tan(phiK)-Math.sin(phi)*Math.cos(lambdaK-lambda)); return Math.round(psi);
Ref: http://www.islamicsoftware.org/qibla/qibla.html
Menghitung Arah
Arah:
β = atan2(X,Y),
Dimana
X = cos θb * sin ∆L Y = cos θa * sin θb – sin θa * cos θb * cos ∆L