Created
September 6, 2016 17:56
-
-
Save vicenteguerra/5b745fd17a2961aa93c645303880feb2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'); | |
var cheerio = require('cheerio'); | |
//var GeoPoint = require('geopoint'); | |
//19.333009,-99.195714 | |
var radius = "5000"; | |
var latitude = "19.333000"; | |
var longitude = "-99.185070"; | |
var query = "bancomer"; | |
//var islas = new GeoPoint(latitude, longitude); | |
//var points = islas.boundingCoordinates(1, inKilometers = true); | |
//console.log(points); | |
var key = "AIzaSyBLmCcxHekRya95Gd27DxFqKNw3xXtOuSA"; | |
var url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=" + latitude + "," + longitude + "&radius=" + radius + "&types=bank&name=" + query + "&key=" + key; | |
var banks = Array(); | |
request(url, function (error, response, body) { | |
var json = JSON.parse(body); | |
var results = json.results; | |
results.forEach(function(currentValue,index){ | |
var bank = { | |
id: currentValue.id, | |
name: currentValue.name, | |
location: currentValue.geometry.location | |
}; | |
banks.push(bank); | |
}); | |
console.log(JSON.stringify(banks)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment