1.0.4 • Published 6 years ago

distance-location v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

calculate distance between two points / coordinates. It is different with google distance matrix which is calculate distance based on routes. This package calculate the length of one line from a point to another point in the earth.

Installation

npm install --save distance-location

Usage

var dist = distance.between(coordinate1, coordinate2, [unit])

Types / Params

coordinate = {
  lat: Number,
  lng: Number
}

unit 'km' (default) | 'm'. Unit is optional, if you don't supply the param, the default param 'km' will be used.

unit = 'km' (default)
unit = 'm'

Example

var distance = require('distance-location')

location1 = {
  lat: -7.2606503,
  lng: 112.7349606
}

location2 = {
  lat: -7.2630689,
  lng: 112.7355421
}

var dist = distance.between(location1, location2, 'm')
console.log(dist)
1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago