1.0.7 • Published 4 years ago

gpsdist v1.0.7

Weekly downloads
14
License
ISC
Repository
-
Last release
4 years ago

gpsdist

gpsdist calculates distance covered in the given path using Haversine formula.

Installation

gpsdist requires Node.js v4+ to run.

$ npm install gpsdist

Example

To get total distance travelled in a given path, pass array of Latitude and Longitude of all points. Total distance travelled is the sum of all distances between each two consecutive points.

const dataArray = [ 
    {time: '2018-10-02T07:56:37Z', value: '72.916245', sensor: 'LNG'},
    {time: '2018-10-02T07:56:37Z', value: '19.089626', sensor: 'LAT'},
    {time: '2018-10-02T07:56:34Z', value: '72.916115', sensor: 'LNG'},
    {time: '2018-10-02T07:56:34Z', value: '19.089705', sensor: 'LAT'},
    {time: '2018-10-02T07:56:34Z', value: '72.916109', sensor: 'LNG'},
    {time: '2018-10-02T07:56:34Z', value: '19.089640', sensor: 'LAT'}];

require('gpsdist')(dataArray)
    .then(data => {console.log('Distance Travelled:-',data);})
    .catch(error => {console.log('error', error);});

    /** Result 
      * Distance Travelled:- 14.375432896356347 metres
     **/ 
1.0.7

4 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.0

6 years ago