mirror of
https://github.com/acamarata/qibla.git
synced 2026-07-01 03:14:30 +00:00
45 lines
706 B
Markdown
45 lines
706 B
Markdown
[**@acamarata/qibla v1.1.1**](../README.md)
|
|
|
|
***
|
|
|
|
[@acamarata/qibla](../README.md) / distanceKm
|
|
|
|
# Function: distanceKm()
|
|
|
|
> **distanceKm**(`lat1`, `lng1`, `lat2`, `lng2`): `number`
|
|
|
|
Defined in: [index.ts:142](https://github.com/acamarata/qibla/blob/a59756bd074a18a3c9cea4311d135cfb23a5ec7d/src/index.ts#L142)
|
|
|
|
Haversine distance between two coordinate pairs.
|
|
|
|
## Parameters
|
|
|
|
### lat1
|
|
|
|
`number`
|
|
|
|
First point latitude in decimal degrees.
|
|
|
|
### lng1
|
|
|
|
`number`
|
|
|
|
First point longitude in decimal degrees.
|
|
|
|
### lat2
|
|
|
|
`number`
|
|
|
|
Second point latitude in decimal degrees.
|
|
|
|
### lng2
|
|
|
|
`number`
|
|
|
|
Second point longitude in decimal degrees.
|
|
|
|
## Returns
|
|
|
|
`number`
|
|
|
|
Distance in kilometers (spherical Earth approximation).
|