I want to develop one Qibla app which helps to find out the direction of prayer for Muslims. Qibla is the direction of ka'ba located in KSA, and its angle will be different from different locations, and i want to find the angle of degree for Qibla from everywhere by fetching user's latitude and longittude.I found some calculations here, but not helped it (It gives wrong result, when i checked). Do anyone have any source or anyone can help me find out the angle of degree from lat & long. Thank you.


Calculation as per in the link

Fd: 11.8745° N

Ld: 75.3704° E

Fm: 21.45° Lm: -39.75°

Q = tan-1 sin (Ld - Lm) [ (cos Fd) x (tan Fm) ] - [ (sin Fd) x (cos Ld - Lm) ]

Where: Fd = Latitude of Desired Location Ld = Longitude of Desired Location Fm = Latitude of Mecca (+21.45° north of Equator) Lm = Longitude of Mecca (-39.75° east of Prime Meridian)

expected angle,Q=292°

but result is not like this

  • 2
    $\begingroup$ What is wrong with the page you linked? $\endgroup$ – Aretino May 15 '17 at 10:26
  • $\begingroup$ I didn't check the equations of your link, but I don't see the difference between that link and what you're trying to do. Maybe you want an explanation of how one gets to these equations? $\endgroup$ – N.Bach May 15 '17 at 16:31
  • $\begingroup$ @Aretino I got wrong degrees for my location from that calculation. $\endgroup$ – Mumthezir VP May 16 '17 at 5:07
  • $\begingroup$ @N.Bach But the angle of degree got from the calculation is wrong $\endgroup$ – Mumthezir VP May 16 '17 at 5:09
  • $\begingroup$ Could you provide one set of input (latitude,longitude) coordinates and the expected output angle then? It will help in verifying equations of potential answerers. $\endgroup$ – N.Bach May 16 '17 at 10:01

I do not know if you're looking for this:

Coordinates of Mecca: $21° 25′ 21″ N, 39° 49′ 34″ E =21.4225°, 39.826111°$ (I recommend you geoHack)

Compare these coordinates with the exact coordinates of the Muslim in question.

(To develop the application realistically, there are a few satellites orbiting the Earth and millions of devices, among which will be the motives of Muslims, which through the GPS system will provide you with information on when and where they are .. . If I did not misunderstand you, create a megabase of data with every possible Earth point and angles that could form is "a great delay", plus it would be very slow and nobody would install it on your mobile: P)



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.