calcul-time-distances
v1.1.2
Published
A module to calculate distance and time between 2 points with differents transport's way.
Downloads
7
Readme
calcul-time-distances
version 1.1.1
A module to calcul time and distance between 2 points. Based on Google Maps API
Prerequisite
You need to obtain an api key. How to obtain API key ?
Install
npm install calcul-time-distances
Example
// Import package
var calculDistance = require("calcul-time-distances")
calculDisance.getDistances(
"Paris", // Origin
"Orsay", // Destination
"driving", // Mode
"AIzaSyD35qhFxfb4gzqB4a_egNd0z4JgmgCIUUY" // Api Key
).then(data => {
// Do something with data
console.log(data)
})
Available modes
- [x] driving
- [x] walking
- [x] bicycling
- [ ] transit (premium)
Returned value
{
"destination_addresses" : [ "91400 Orsay, France" ],
"origin_addresses" : [ "Paris, France" ],
"rows" : [
{
"elements" : [
{
"distance" : {
"text" : "32,0 km",
"value" : 31962
},
"duration" : {
"text" : "38 minutes",
"value" : 2295
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}