'Best way to find distance between two geopoints(lats, longs) in node.js [duplicate]

Can anyone pls tell me what is the best way to find distance between two geopoints (lats, longs) in node.js . If there is any good node js library pls tell me. Also I dont want to find the straight line path i want to find the possible driving path between the locations.

Thank you in Advance



Solution 1:[1]

Ok, according to the wording of your last, you need a wrapper to services like Google Distance Matrix API or The Google Directions API. For example: Google Distance Matrix API for Node.js:

Solution 2:[2]

You should try geopoint (https://www.npmjs.com/package/geopoint) In order to measure the distance from point1 to point2 use

`
var GeoPoint = require('geopoint');
point1 = new GeoPoint(lat1, long1);
point2 = new GeoPoint(lat2, long2);
var distance = point1.distanceTo(point2, true)//output in kilometers
`

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 stdob--
Solution 2 Fotis Tsokos