get-haversine-distance

1.0.0 • Public • Published

get-haversine-distance

package version package downloads standard-readme compliant package license make a pull request

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

  1. Fork it and create your feature branch: git checkout -b my-new-feature
  2. Commit your changes: git commit -am 'Add some feature'
  3. Push to the branch: git push origin my-new-feature
  4. Submit a pull request

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i get-haversine-distance

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

131 kB

Total Files

5

Last publish

Collaborators

  • tiaanduplessis