Qibla direction, great-circle path, and haversine distance. Pure math, zero dependencies.
Find a file
2026-05-28 14:00:04 -04:00
.claude chore: bump to v1.1.1 2026-05-28 13:54:56 -04:00
.github docs(e6): add wiki pages — Sidebar, Footer, Contributing, SECURITY, CODE_OF_CONDUCT 2026-05-28 14:00:04 -04:00
src chore: align repository structure with portfolio documentation standards 2026-05-15 15:27:43 -04:00
.editorconfig Initial release: qibla v1.0.0 2026-03-08 12:44:01 -04:00
.gitignore Initial release: qibla v1.0.0 2026-03-08 12:44:01 -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
.prettierrc Initial release: qibla v1.0.0 2026-03-08 12:44:01 -04:00
CHANGELOG.md chore: bump to v1.1.1 2026-05-28 13:54:56 -04:00
eslint.config.js Initial release: qibla v1.0.0 2026-03-08 12:44:01 -04:00
LICENSE Initial commit 2026-03-08 12:37:35 -04:00
package.json chore: bump to v1.1.1 2026-05-28 13:54:56 -04:00
pnpm-lock.yaml Initial release: qibla v1.0.0 2026-03-08 12:44:01 -04:00
pnpm-workspace.yaml Initial release: qibla v1.0.0 2026-03-08 12:44:01 -04:00
README.md chore: bump to v1.1.1 2026-05-28 13:54:56 -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 Initial release: qibla v1.0.0 2026-03-08 12:44:01 -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

@acamarata/qibla

npm version CI License: MIT

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