1.0.5 • Published 3 years ago

calculate-distance-between-coordinates v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Calculate Distance between coordinates

  • get the distance between two points
  • get the distance between a list of points

Installation

NPM

npm install calculate-distance-between-coordinates

Yarn

yarn add calculate-distance-between-coordinates

Methods

getDistanceBetweenTwoPoints

function getDistanceBetweenTwoPoints(
  cord1: Coordinate,
  cord2: Coordinate,
  unit: Unit = 'km',
): number

getTotalDistance

export function getTotalDistance(
  coordinates: Coordinate[],
  unit: Unit = "km"
): number

Types

type Coordinate = {
  lat: number;
  lon: number;
};

type Unit = 'km' | 'mile';
1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago