2.0.4 • Published 4 years ago

geo-distance-helper v2.0.4

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

geo-distance-helper

Get distance between two points in kilometers, nautical miles 100% typescript, get autocompletions while using.

Install

  • npm
npm install geo-distance-helper
  • yarn
yarn add geo-distance-helper

API

ArgsTypeRequiredDefaultDescription
point1GeoPointtrue-Point1 coordinates
point2GeoPointtrue-Point2 coordinates
unitstringfalse'K''K': Kilometers, 'N': Nautical miles

Types

  • GeoPoint
ArgsTypeRequiredDefaultDescription
latnumbertrue-Point latitude
lngnumbertrue-Point longitude

Example Usage

import geoDistance from 'geo-distance-helper';
// const geoDistance = require('geo-distance-helper');

const point1 = {lat: 36, lng: 42};
const point2 = {lat: 64, lng: 21};

// distance in kilometers
const distance = geoDistance(point1, point2);
// or
const distance = geoDistance(point1, point2, 'K');

// distance in nautical miles
const distance = geoDistance(point1, point2, 'N');
2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.1.2

4 years ago

1.0.0

4 years ago