mirror of
https://github.com/acamarata/qibla.git
synced 2026-07-01 03:14:30 +00:00
1 KiB
1 KiB
@acamarata/qibla / qiblaAngle
Function: qiblaAngle()
qiblaAngle(
lat,lng):number
Defined in: index.ts:46
Qibla bearing in degrees clockwise from true north.
Uses the forward azimuth formula from spherical trigonometry. Result range: [0, 360).
Parameters
lat
number
Observer latitude in decimal degrees (-90 to 90).
lng
number
Observer longitude in decimal degrees (-180 to 180).
Returns
number
Bearing in degrees clockwise from north (0 = N, 90 = E, 180 = S, 270 = W).
Throws
If latitude is outside [-90, 90] or longitude outside [-180, 180].
Example
qiblaAngle(40.7128, -74.006); // ~58.49 (New York)
qiblaAngle(51.5074, -0.1278); // ~119.0 (London)
See
https://github.com/acamarata/qibla/wiki/api/qiblaAngle Wiki API page