1.1.19 • Published 1 year 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
1 year ago
1.1.18
1 year ago
1.1.17
1 year ago
1.1.16
1 year ago
1.1.15
1 year ago
1.1.14
1 year ago
1.1.13
1 year ago
1.0.9
1 year ago
1.0.8
1 year ago
1.0.7
1 year ago
1.0.6
1 year ago
1.0.5
1 year ago
1.0.11
1 year ago
1.0.10
1 year ago
1.0.13
1 year ago
1.0.12
1 year ago
1.0.4
1 year ago
1.0.3
1 year ago
1.0.2
1 year ago
1.0.1
1 year ago
1.0.0
1 year ago