Qibla direction, great-circle path, and haversine distance. Pure math, zero dependencies.
Find a file
2026-06-13 10:27:10 -04:00
.github chore: update docs and CI (E8 QA + E11 consolidation prep) 2026-05-30 18:38:21 -04:00
src chore: update docs and CI (E8 QA + E11 consolidation prep) 2026-05-30 18:38:21 -04:00
.editorconfig Initial release: qibla v1.0.0 2026-03-08 12:44:01 -04:00
.gitignore chore: stop tracking generated coverage artifacts 2026-06-13 10:27:10 -04:00
.npmrc Initial release: qibla v1.0.0 2026-03-08 12:44:01 -04:00
.nvmrc Initial release: qibla v1.0.0 2026-03-08 12:44:01 -04:00
CHANGELOG.md chore: bump to v1.1.2 2026-05-30 19:11:44 -04:00
eslint.config.js ci: fix eslint parser devDeps and typed-linting config 2026-05-31 08:47:15 -04:00
LICENSE Initial commit 2026-03-08 12:37:35 -04:00
package.json ci: fix eslint parser devDeps and typed-linting config 2026-05-31 08:47:15 -04:00
pnpm-lock.yaml ci: fix eslint parser devDeps and typed-linting config 2026-05-31 08:47:15 -04:00
pnpm-workspace.yaml Initial release: qibla v1.0.0 2026-03-08 12:44:01 -04:00
README.md chore: update docs and CI (E8 QA + E11 consolidation prep) 2026-05-30 18:38:21 -04:00
test-cjs.cjs Initial release: qibla v1.0.0 2026-03-08 12:44:01 -04:00
test.mjs Initial release: qibla v1.0.0 2026-03-08 12:44:01 -04:00
tsconfig.json chore: adopt shared config packages (tsconfig, eslint, prettier) 2026-05-30 15:07:02 -04:00
tsup.config.ts feat: add wiki, fix README scoped package name, CI and package improvements 2026-03-08 16:37:26 -04:00
typedoc.json docs: add TypeDoc API generation (typedoc@0.28.19 + typedoc-plugin-markdown@4.11.0) 2026-05-30 16:41:58 -04:00

@acamarata/qibla

npm version CI License: MIT Wiki

Qibla direction, great-circle path, and haversine distance. Pure math, zero dependencies.

Installation

npm install @acamarata/qibla

Quick Start

import { qiblaAngle, compassDir, distanceKm, KAABA_LAT, KAABA_LNG } from '@acamarata/qibla';

// Bearing from New York to the Ka'bah
const bearing = qiblaAngle(40.7128, -74.006);
console.log(bearing);          // ~58.48 degrees
console.log(compassDir(bearing)); // "NE"

// Distance in kilometers
const km = distanceKm(40.7128, -74.006, KAABA_LAT, KAABA_LNG);
console.log(km); // ~9,634

CommonJS:

const { qiblaAngle } = require('@acamarata/qibla');

Use qiblaGreatCircle(lat, lng, steps?) to generate waypoints along the great-circle path for map overlays.

TypeScript

import { qiblaAngle, CompassAbbr, CompassName } from '@acamarata/qibla';

Documentation

Full API reference, algorithm design, and spherical trigonometry notes: GitHub Wiki

Acknowledgments

Ka'bah coordinates verified against published GPS surveys and cross-checked with satellite imagery. Forward azimuth formula follows standard spherical trigonometry as used in aviation and geodesy.

License

MIT