Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/russbiggs/asturlab
qibla calculator 🧭🕋
https://github.com/russbiggs/asturlab
astrolabe islam kaaba qibla qiblah-direction
Last synced: 6 days ago
JSON representation
qibla calculator 🧭🕋
- Host: GitHub
- URL: https://github.com/russbiggs/asturlab
- Owner: russbiggs
- License: other
- Created: 2019-01-24T16:40:35.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-24T16:56:36.000Z (almost 6 years ago)
- Last Synced: 2025-01-11T18:43:59.317Z (7 days ago)
- Topics: astrolabe, islam, kaaba, qibla, qiblah-direction
- Language: TypeScript
- Homepage:
- Size: 74.2 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Asturlab - ٱلأَسْطُرلاب
A small JavaScript library to calculate the qibla (direction to the kaaba in Mecca) from a given coordinate pair. Calculates using [great-circle](https://en.wikipedia.org/wiki/Great-circle_distance) (default) or a [rhumb line](https://en.wikipedia.org/wiki/Rhumb_line). Most of the code adaptions of the calculations in the source code are directly from or adapted from [turf.js](http://turfjs.org/), however turf is not a dependency.
## Installation
```sh
npm install asturlab
```## Usage
Available in AMD, CJS, IIFE (with compatible version down to IE10) and ES6 Module.
### In the browser
#### as an ES6 Module
```js
import asturlab from 'asturlab';
```### from a script tag
```html
```
### In node
```js
const asturlab = require('asturlab');
const qibla = asturlab([32.123, 54.321]);
// qibla is now the bearing to the kaaba in degrees
```## API
__asturlab(coordinates[, options]])__
```coordinates``` is a \[x,y\] (long, lat) pair of decimal degree coordinates in WGS84
```options``` supported:
* ``` rhumb ``` - boolean, sets calculation to use rhumb line instead of great circle