1.1.19 • Published 5 months ago
formula-haversine v1.1.19
haversine-distance
Javascript/Typescript - The fatest implementation of the Haversine formula to calculate the great-circle distance between two geographical points on Earth. The distance is returned in kilometers.
🔍️ Example
✨ Import
import haversine from 'formula-haversine'
// or
const haversine = require('formula-haversine')
📌 Usage
// For example i want calculate distance bewteen Paris: { 48.864716, 2.349014 } and Tokyo: { 35.67619190, 139.65031060 } :
// Define coordinates.
const parisLatitude = 48.864716
const parisLongitude = 2.349014
const tokyoLatitude = 35.67619190
const tokyoLongitude = 139.65031060
// Compute the distance.
const distance = haversine(parisLatitude, parisLongitude, tokyoLatitude, tokyoLongitude);
// Note: The result is in kilometers, rounded down to the nearest integer.
console.log(`Distance between Paris and Tokyo: ${distance} km`)
LICENSE MIT
1.1.19
5 months ago
1.1.18
5 months ago
1.1.17
5 months ago
1.1.16
5 months ago
1.1.15
5 months ago
1.1.14
5 months ago
1.1.13
5 months ago
1.0.9
6 months ago
1.0.8
6 months ago
1.0.7
6 months ago
1.0.6
6 months ago
1.0.5
6 months ago
1.0.11
6 months ago
1.0.10
6 months ago
1.0.13
5 months ago
1.0.12
6 months ago
1.0.4
6 months ago
1.0.3
6 months ago
1.0.2
6 months ago
1.0.1
6 months ago
1.0.0
6 months ago