/haversine-distance

Haversine formula in Javascript. In meters. Nothing more.

Primary LanguageJavaScriptMIT LicenseMIT

haversine-distance

build status Version

js-standard-style

Haversine formula in Javascript. In meters. Nothing more.

Example

var haversine = require('haversine-distance')

var a = { latitude: 37.8136, longitude: 144.9631 }
var b = { latitude: 33.8650, longitude: 151.2094 }

// 714504.18 (in meters)
console.log(haversine(a, b))

lat, lng and lon works too:

var haversine = require('haversine-distance')

var a = { lat: 37.8136, lng: 144.9631 }
var b = { lat: 33.8650, lon: 151.2094 }

// 714504.18 (in meters)
console.log(haversine(a, b))

License MIT