apollodec/Apollo/bower_components/ngmap/testapp/scripts/get-starbucks.js
venbatechnologies@gmail.com d06b1c0cba status file
2017-12-07 11:31:25 +05:30

20 lines
526 B
JavaScript
Executable File

/**
* This is to generate startbucks.json, locations of all starbucks world wide
*/
var request = require("request");
var base = "http://opendata.socrata.com/resource/92ua-293q.json";
var stores = [];
for (var i=0; i<21000; i+=1000) {
var url = base + "?$offset=" + i;
request({ url: url, json: true }, function (error, response, body) {
if (!error && response.statusCode === 200) {
stores = stores.concat(body);
}
if (stores.length > 20000) {
console.log(JSON.stringify(stores));
}
})
}