New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

haversine-js

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

haversine-js

Determine the great-circle distance between two points on a sphere given their longitudes and latitudes

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

haversine-js Build Status

Implementation of the haversine formula to calculate the great-circle distance between two points on a sphere given their longitudes and latitudes :earth_americas:

Install

$ npm install --save haversine-js

Usage

const haversine = require('haversine-js');

const atlanta = {
  latitude: 33.7490,
  longitude: -84.3880
};

const london = {
  latitude: 51.5074,
  longitude: -0.1278
};

const options = {
    radius: haversine.EARTH.MILE
};

haversine(atlanta, london, options).toFixed(0);
//=> 4207

API

haversine(start, end, [,options])

start, end

Type: object

Object containing the longitude/latitude coordinate pair for either point.

const start = {
    longitude: 33.7490,
    latitude: 84.3880
};

options

radius

Type: number
Default: haversine.EARTH.MILE

The radius of the sphere.

isRadians

Type: boolean
Default: false

Set to true if the longitude/latitude values are in radians.

Constants

Radii

ConstantValue
EARTH.MILE3959
EARTH.KM6371
EARTH.M6371000
EARTH.NMI3440

License

MIT © Brandon Smith

Keywords

haversine

FAQs

Package last updated on 14 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts