search-itineraries-under-max-time

1.0.0 • Public • Published

Polytech Paris-sud

search-itinary-on-itinary

version 1.0.0

A module to search an itinary on another itinary with a max added time.

Prerequisite

You need to obtain an api key. How to obtain API key ?

Install

npm install calcul-time-distances compare-itinerary search-itineraries-under-max-time

Example

// Import package
var searchItineraries = require("search-itineraries-under-max-time")

searchItineraries.getItinerariesWithMaxTime(
  <myItinerary>,  // The function will return all itineraries under the radius distance and the time from this itinerary
  <existingItineraries>,  // The itineraries where we want to search
  <radius>, // Max radius of the destination between our itinerary and the others
  <time>, // Max time between our itinerary and the others
  <API_key> // API Key
).then(data => {
  // Do something with data
  console.log(data)
})

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"
},
{
   "destination_addresses" : [ "91400 Orsay, France" ],
   "origin_addresses" : [ "Paris, France" ],
   "rows" : [
      {
         "elements" : [
            {
               "distance" : {
                  "text" : "31,9 km",
                  "value" : 31856
               },
               "duration" : {
                  "text" : "39 minutes",
                  "value" : 2345
               },
               "status" : "OK"
            }
         ]
      }
   ],
   "status" : "OK"
}]

Readme

Keywords

Package Sidebar

Install

npm i search-itineraries-under-max-time

Weekly Downloads

8

Version

1.0.0

License

ISC

Unpacked Size

4.42 kB

Total Files

3

Last publish

Collaborators

  • terafu