geodetic-haversine-distance

v1.0.1
Distance between two latitude/longitude coordinates taking latitude into account
geo haversine distance coordinates latitude longitude

geodetic-haversine-distance

Greenkeeper badge

This function calculates the distance in meters between two latitude/longitude coordinates. Instead of using a mean radius of Earth, the radius is estimated using the latitude of the first position.

Install

$ npm install --save geodetic-haversine-distance

Usage

const haversineDistance = require('geodetic-haversine-distance');

const a = { latitude: 59.338746, longitude: 18.060683 };
const b = { latitude: 59.339042, longitude: 18.061779 };

haversineDistance(a, b);
//=> 70.37704048362993

API

haversineDistance(start, end)

Calculate the distance in meters between two positions. The two positions must have the properties latitude and longitude.

npm i geodetic-haversine-distance

Metadata

  • MIT
  • >=4
  • David Brockman Smoliansky
  • released 2/12/2017

Downloads

Maintainers