{"_id":"google-distance-matrix","_rev":"12-1a46933ff6f919316fa95c65d6413227","name":"google-distance-matrix","description":"A Node.js wrapper for Google Maps Distance Matrix API","dist-tags":{"latest":"1.1.1"},"versions":{"0.0.1":{"name":"google-distance-matrix","version":"0.0.1","description":"A Node.js wrapper for Google Maps Distance Matrix API","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://ecteodoro@github.com/ecteodoro/google-distance-matrix.git"},"keywords":["google","distance","matrix","api","maps","json","node"],"author":{"name":"Ecil Teodoro"},"license":"MIT","bugs":{"url":"https://github.com/ecteodoro/google-distance-matrix/issues"},"homepage":"https://github.com/ecteodoro/google-distance-matrix","dependencies":{"qs":"^0.6.6","request":"^2.36.0"},"_id":"google-distance-matrix@0.0.1","_shasum":"d5fd5421764c29df3d91f4d724bf4340b2e48672","_from":"google-distance-matrix","_npmVersion":"1.4.9","_npmUser":{"name":"ecteodoro","email":"ecil.teodoro@gmail.com"},"maintainers":[{"name":"ecteodoro","email":"ecil.teodoro@gmail.com"}],"dist":{"shasum":"d5fd5421764c29df3d91f4d724bf4340b2e48672","tarball":"https://registry.npmjs.org/google-distance-matrix/-/google-distance-matrix-0.0.1.tgz","integrity":"sha512-a7VtK0IzJNtbD5FpWj5XUncx4is/Mf2y5L8ZTy2eNe2r2mXlewS2iUXGhaI8qHpHfvYaCh1VPyJwz9PPNvnG4w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE9VPzqmjzSBvDZDpuuUt+Cy4KBFm+qWkJWJMGcjOwfQAiBR04SF8Pki9ZgOLvpWq9N6bY19aa1RMkV/zhVfheNhFQ=="}]}},"0.0.2":{"name":"google-distance-matrix","version":"0.0.2","description":"A Node.js wrapper for Google Maps Distance Matrix API","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://ecteodoro@github.com/ecteodoro/google-distance-matrix.git"},"keywords":["google","distance","matrix","api","maps","json","node"],"author":{"name":"Ecil Teodoro"},"license":"MIT","bugs":{"url":"https://github.com/ecteodoro/google-distance-matrix/issues"},"homepage":"https://github.com/ecteodoro/google-distance-matrix","dependencies":{"qs":"^0.6.6","request":"^2.36.0"},"_id":"google-distance-matrix@0.0.2","_shasum":"2a5d2f0596609767be826e65b5353be214a78f83","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"ecteodoro","email":"ecil.teodoro@gmail.com"},"maintainers":[{"name":"ecteodoro","email":"ecil.teodoro@gmail.com"}],"dist":{"shasum":"2a5d2f0596609767be826e65b5353be214a78f83","tarball":"https://registry.npmjs.org/google-distance-matrix/-/google-distance-matrix-0.0.2.tgz","integrity":"sha512-ClnBES96OQ4Arzs0nEz1+DumPZh9XUztvbGtsVtEceTE+7J/a2yJ6mBk/Py+eMIzSkt1qIXS+7TI+FbAlMeFDQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE9pkrJNKJQNrFXsC/rlJ5nY9RuBFTh3kECp/MuqrszSAiAmOkiE3f+8245FCrBW44V/pZ2XuPJNvpv/W8UQ2ORbHQ=="}]}},"0.0.3":{"name":"google-distance-matrix","version":"0.0.3","description":"A Node.js wrapper for Google Maps Distance Matrix API","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://ecteodoro@github.com/ecteodoro/google-distance-matrix.git"},"keywords":["google","distance","matrix","api","maps","json","node"],"author":{"name":"Ecil Teodoro"},"license":"MIT","bugs":{"url":"https://github.com/ecteodoro/google-distance-matrix/issues"},"homepage":"https://github.com/ecteodoro/google-distance-matrix","dependencies":{"debug":"^2.1.0","qs-google-signature":"^1.1.1","request":"^2.36.0"},"_id":"google-distance-matrix@0.0.3","dist":{"shasum":"4095eab45d325d972ff63e31c7f440280ec99539","tarball":"https://registry.npmjs.org/google-distance-matrix/-/google-distance-matrix-0.0.3.tgz","integrity":"sha512-tJWFQP9cSIwv+sU5xaaEprSIohWlbY6hZLae0NdowgRDmulVn2QXlSzRPzcIOUPRH/7EWy2mwQMpY8n9vYkMjw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFAzZNLs30EF4+m2Mf+IkL40hMAW5m5rhVbGUqrbqSAAAiEA+NBOSP49JiLL/ji6BmdKyU6zbpremZ55yUErxvPwSFU="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"ecteodoro","email":"ecil.teodoro@gmail.com"},"maintainers":[{"name":"ecteodoro","email":"ecil.teodoro@gmail.com"}]},"1.0.0":{"name":"google-distance-matrix","version":"1.0.0","description":"A Node.js wrapper for Google Maps Distance Matrix API","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://ecteodoro@github.com/ecteodoro/google-distance-matrix.git"},"keywords":["google","distance","matrix","api","maps","json","node"],"author":{"name":"Ecil Teodoro"},"license":"MIT","bugs":{"url":"https://github.com/ecteodoro/google-distance-matrix/issues"},"homepage":"https://github.com/ecteodoro/google-distance-matrix","dependencies":{"debug":"^2.1.0","qs-google-signature":"^1.1.1","request":"^2.36.0"},"gitHead":"fc10240553a12e0f0c3d98461173c5d06456f38e","_id":"google-distance-matrix@1.0.0","_shasum":"1103e7727d3d456f3f76563633eeaacdd3464c92","_from":".","_npmVersion":"4.5.0","_nodeVersion":"7.4.0","_npmUser":{"name":"ecteodoro","email":"ecil.teodoro@gmail.com"},"dist":{"shasum":"1103e7727d3d456f3f76563633eeaacdd3464c92","tarball":"https://registry.npmjs.org/google-distance-matrix/-/google-distance-matrix-1.0.0.tgz","integrity":"sha512-rSk6Pnpvyoy4t3OJSqsSqXbw3ZxBD+JkpJ7z5VVJYrHq6wwbI8SqkHDDuu4SVO/7ydrkSFSasHrcoZbSk4oNPg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEXDB4GkwHI3b4WwI4qSfWJVEopjSFFVTc3UP4CAIP85AiAQ1+LWX7rHmCnTMtdTyVBVJ2wW3yW9ge4yeSEJhDDFhQ=="}]},"maintainers":[{"name":"ecteodoro","email":"ecil.teodoro@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/google-distance-matrix-1.0.0.tgz_1495079011445_0.014698730548843741"}},"1.1.0":{"name":"google-distance-matrix","version":"1.1.0","description":"A Node.js wrapper for Google Maps Distance Matrix API","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://ecteodoro@github.com/ecteodoro/google-distance-matrix.git"},"keywords":["google","distance","matrix","api","maps","json","node"],"author":{"name":"Ecil Teodoro"},"license":"MIT","bugs":{"url":"https://github.com/ecteodoro/google-distance-matrix/issues"},"homepage":"https://github.com/ecteodoro/google-distance-matrix","dependencies":{"debug":"^2.1.0","qs-google-signature":"^1.1.1","request":"^2.36.0"},"gitHead":"795dcd518ff95eb9754c80c391445bb1d44f09ab","_id":"google-distance-matrix@1.1.0","_shasum":"ff8a7cbd2fc34be924e9cd35e116c8c7f6dd90cd","_from":".","_npmVersion":"4.0.5","_nodeVersion":"6.9.2","_npmUser":{"name":"ecteodoro","email":"ecil.teodoro@gmail.com"},"dist":{"shasum":"ff8a7cbd2fc34be924e9cd35e116c8c7f6dd90cd","tarball":"https://registry.npmjs.org/google-distance-matrix/-/google-distance-matrix-1.1.0.tgz","integrity":"sha512-ZazNSjxri0NzaUTSAFE+2LByPfDn7eo5we9a2yL5Hlv19wtFLn+kqZv/VXE/u+0PU9c5NK3O+YAdUoSLA1CTJw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHPF7CePMc8RN7SNVQI7Ot06fXOdhPzpS4+iacGbs/vgAiBQ8PUYmN+ep/lJIAQHTsI/0k+T0XL0/ALYpVsOYDyxjQ=="}]},"maintainers":[{"name":"ecteodoro","email":"ecil.teodoro@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/google-distance-matrix-1.1.0.tgz_1513363768630_0.8033728436566889"}},"1.1.1":{"name":"google-distance-matrix","version":"1.1.1","description":"A Node.js wrapper for Google Maps Distance Matrix API","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://ecteodoro@github.com/ecteodoro/google-distance-matrix.git"},"keywords":["google","distance","matrix","api","maps","json","node"],"author":{"name":"Ecil Teodoro"},"license":"MIT","bugs":{"url":"https://github.com/ecteodoro/google-distance-matrix/issues"},"homepage":"https://github.com/ecteodoro/google-distance-matrix","dependencies":{"debug":"^2.1.0","qs-google-signature":"^1.1.1","request":"^2.36.0"},"gitHead":"4444c2d3842fd0e9b45c9d85bc06f194e5069f9e","_id":"google-distance-matrix@1.1.1","_shasum":"110aec362ae2503480b9415bf97f3f713c4d15bb","_from":".","_npmVersion":"4.0.5","_nodeVersion":"6.9.2","_npmUser":{"name":"ecteodoro","email":"ecil.teodoro@gmail.com"},"dist":{"shasum":"110aec362ae2503480b9415bf97f3f713c4d15bb","tarball":"https://registry.npmjs.org/google-distance-matrix/-/google-distance-matrix-1.1.1.tgz","integrity":"sha512-jPLWlDpw+Z082XfVPQFxeYmFdTkV0y1wBXuBgCCpFGXrY8akHp9VrnEUJN2NnTzIqhV/m+SAnhhOXqPn8H7waQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICKerfoW7Mc5ot1dFX82ocDiCxhYWi77BIrjRsEV00q4AiAosuUTWadj3BEDey3XEhIrSGgttszSYyPZXX+z27JYRw=="}]},"maintainers":[{"name":"ecteodoro","email":"ecil.teodoro@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/google-distance-matrix-1.1.1.tgz_1513365498829_0.9172856290824711"}}},"readme":"# Node.js wrapper for Google Distance Matrix API\n\nThe Google Distance Matrix API is a service that provides travel distance and time for a matrix of origins and destinations. The information returned is based on the recommended route between start and end points, as calculated by the Google Maps API, and consists of rows containing duration and distance values for each pair.\n\nPlease refer to [Google Distance Matrix API](https://developers.google.com/maps/documentation/distancematrix/) documentation for further details on **request parameters** and **response format**.\n\nUnlike similar modules, this one accepts multiple origins and the result data is just like the one returned by the Google API.\n\n## Installation\n\n`npm install google-distance-matrix`\n\n## Usage\n```javascript\nvar distance = require('google-distance-matrix');\n\nvar origins = ['San Francisco CA'];\nvar destinations = ['New York NY', '41.8337329,-87.7321554'];\n\ndistance.matrix(origins, destinations, function (err, distances) {\n    if (!err)\n        console.log(distances);\n})\n```\n## Parameters\n\n### API Key\n\nPlease read the [API Key](https://developers.google.com/maps/documentation/distancematrix/#api_key) documentation first.\n\nIf using a **key**:\n\n* There are 2 options to define the key:  \n\n1. Create an environment variable `GOOGLE_API_KEY`, or...  \n2. Programatically:\n```javascript\ndistance.key('YOUR-API-KEY');\n```\n\nIf using **client** and **signature**:  \n\n1. Create environment variables `GOOGLE_CLIENT_KEY` and `GOOGLE_SIGNATURE_KEY`, or...  \n2. Programmatically:\n```javascript\ndistance.client('YOUR-CLIENT-KEY');\ndistance.signature('YOUR-SIGNATURE');\n```\n\n### Options\n\nMode (optional): `driving | walking | bicycling | transit`, default `driving`  \n\n```javascript\ndistance.mode('driving');\n```\n\nLanguage (optional): default `en`\n\n```javascript\ndistance.language('pt');\n```\n\nAvoid (optional): `tolls | highways | ferries | indoor`, default: `null`\n\n```javascript\ndistance.avoid('tolls');\n```\n\nUnits (optional): `metric | imperial`, default: `metric`\n\n```javascript\ndistance.units('imperial');\n```\n\nDeparture time (optional): desired time of departure as seconds since midnight, January 1, 1970 UTC\n\n```javascript\ndistance.departure_time(1404696787);\n```\n\nArrival time (optional): desired time of arrival as seconds since midnight, January 1, 1970 UTC\n\n```javascript\ndistance.arrival_time(1404696787);\n```\n\nTraffic model (this parameter may only be specified for requests where the travel mode is `driving`, and where the request includes a `departure_time`): `best_guess | pessimistic | optimistic`, default `best_guess`\n\n```javascript\ndistance.traffic_model('optimistic');\n```\n\nTransit mode (this parameter may only be specified for requests where the `mode` is `transit`): `bus | subway | train | tram | rail` \n\n```javascript\ndistance.transit_mode('rail');\n```\n\nTransit routing preference (this parameter may only be specified for requests where the `mode` is `transit`): `less_walking | fewer_transfers`\n\n```javascript\ndistance.transit_routing_preference('fewer_transfers');\n```\n\n### Origins\nAn array of one or more addresses and/or textual latitude/longitude values from which to calculate distance and time. If you pass an address as a string, the service will geocode the string and convert it to a latitude/longitude coordinate to calculate directions. If you pass coordinates, ensure that no space exists between the latitude and longitude values.\n```javascript\n...\nvar origins = ['San Francisco CA', '40.7421,-73.9914'];\n...\n```\n### Destinations\nAn array of one or more addresses and/or textual latitude/longitude values to which to calculate distance and time. If you pass an address as a string, the service will geocode the string and convert it to a latitude/longitude coordinate to calculate directions. If you pass coordinates, ensure that no space exists between the latitude and longitude values.\n```javascript\n...\nvar destinations = ['New York NY', 'Montreal', '41.8337329,-87.7321554', 'Honolulu'];\n...\n```\n## Example\n\n```javascript\nvar distance = require('google-distance-matrix');\n\nvar origins = ['San Francisco CA', '40.7421,-73.9914'];\nvar destinations = ['New York NY', 'Montreal', '41.8337329,-87.7321554', 'Honolulu'];\n\ndistance.key('<Your API key here>');\ndistance.units('imperial');\n\ndistance.matrix(origins, destinations, function (err, distances) {\n    if (err) {\n        return console.log(err);\n    }\n    if(!distances) {\n        return console.log('no distances');\n    }\n    if (distances.status == 'OK') {\n        for (var i=0; i < origins.length; i++) {\n            for (var j = 0; j < destinations.length; j++) {\n                var origin = distances.origin_addresses[i];\n                var destination = distances.destination_addresses[j];\n                if (distances.rows[0].elements[j].status == 'OK') {\n                    var distance = distances.rows[i].elements[j].distance.text;\n                    console.log('Distance from ' + origin + ' to ' + destination + ' is ' + distance);\n                } else {\n                    console.log(destination + ' is not reachable by land from ' + origin);\n                }\n            }\n        }\n    }\n});\n```\n","maintainers":[{"name":"ecteodoro","email":"ecil.teodoro@gmail.com"}],"time":{"modified":"2022-06-18T13:25:58.194Z","created":"2014-07-03T19:37:32.780Z","0.0.1":"2014-07-03T19:37:32.780Z","0.0.2":"2014-07-07T21:01:30.067Z","0.0.3":"2014-12-05T20:50:09.163Z","1.0.0":"2017-05-18T03:43:31.683Z","1.1.0":"2017-12-15T18:49:28.718Z","1.1.1":"2017-12-15T19:18:18.943Z"},"homepage":"https://github.com/ecteodoro/google-distance-matrix","keywords":["google","distance","matrix","api","maps","json","node"],"repository":{"type":"git","url":"git+https://ecteodoro@github.com/ecteodoro/google-distance-matrix.git"},"author":{"name":"Ecil Teodoro"},"bugs":{"url":"https://github.com/ecteodoro/google-distance-matrix/issues"},"license":"MIT","readmeFilename":"README.md","users":{"ecilteodoro":true}}