Skip to content

Instantly share code, notes, and snippets.

@easherma
Created June 23, 2016 02:06
Show Gist options
  • Save easherma/1148f34b3c3bf505b1a0185b621acdf5 to your computer and use it in GitHub Desktop.
Save easherma/1148f34b3c3bf505b1a0185b621acdf5 to your computer and use it in GitHub Desktop.
// read api doc:
// http://developer.factual.com/display/docs/Core+API+-+Read
var auth = require('./auth.js'); //or however you wanna auth
var Factual = require('factual-api');
var factual = new Factual(auth.key, auth.secret);
//factual.startDebug();
radius = 25000;
limit = 50;
offset = 10;
// Geo filter doc:
var array = new Array();
for (var i = 0; i < 1; i++) {
reponse = factual.get('/t/places-us', {
filters:{"$and":[{"country":{"$eq":"US"}},
{"category_ids":{"$includes":"2, 3"}}]},
geo:{"$circle":{"$center":[34.041195,-118.331518],"$meters":radius}}, offset:50*(i), limit:limit},
function (error, res) {
//console.log(res.data);
array.push(res.data);
});
console.log(array);
}
// http://developer.factual.com/display/docs/Core+API+-+Geo+Filters
@easherma
Copy link
Author

auth.js = var KEY = 'YpDcXQ5Opfe39maD5vs1PzH684yMVnU8NEPQriz1';
var SECRET = '6vWYfMXIixPbkxxWNz8OEvKq6LkNqP4Ldh49BgBc';

module.exports = {
key: KEY,
secret: SECRET
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment