get-haversine-distance
v1.0.0
Published
Get distance between two coordinates using haversine formula
Downloads
3
Readme
get-haversine-distance
Get distance between two coordinates using haversine formula
Table of Contents
Install
This project uses node and npm.
$ npm install get-haversine-distance
$ # OR
$ yarn add get-haversine-distance
Usage
const getHaversineDistance = require('get-haversine-distance')
const p1 = {
lat: 11,
lng: 12
}
const p2 = {
lat: 13,
lng: 14
}
const p3 = {
x: 11,
y: 12
}
const p4 = {
x: 13,
y: 14
}
console.log(getHaversineDistance(p1, p2)) // 311.08025949241477
console.log(getHaversineDistance(p1, p2, {inMiles: true})) // 193.29679215853378
console.log(getHaversineDistance(p3, p4, {latName: 'x', lngName: 'y'})) // 311.08025949241477
Contribute
- Fork it and create your feature branch: git checkout -b my-new-feature
- Commit your changes: git commit -am 'Add some feature'
- Push to the branch: git push origin my-new-feature
- Submit a pull request
License
MIT