Created
August 14, 2015 05:48
-
-
Save troy0820/4b3e6442040caea92d43 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
promise.promisifyAll(geocode); | |
var getzips = function(lat,lng) { | |
return new promise(function(resolve, reject) { | |
geocode.reverseGeocodeAsync(lat,lng) | |
.then(function(data) { | |
var zips = data.results[0].address_components[6].short_name; | |
resolve(zips); | |
}) | |
}) | |
.catch(function(err) { | |
console.log(err); | |
}); | |
}; | |
promise.all(lat_lng.lat.map(function(_,index) { | |
return getzips(lat_lng.lat[index],lat_lng.lng[index]); | |
}) | |
).then(function(data) { | |
var zipcodes = _.union(data); | |
console.log('data: ',zipcodes); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment