I am trying to print out a list of places around certain addresses (~200 addresses). However, when I run this code I only get place results for 6 addresses and then in the console I get the message 'Uncaught RangeError: Maximum call stack size exceeded'. I know that my lat and long values are formatted correctly, and set a TimeOut in case I was going over my query limit, does anyone have any ideas on how I can get responses for all 200 addresses? Thanks
function run(){
for (var i=100; i<latss.length;i ++){
var lat = data[i].Lats;
var long = data[i].Longs;
var latlng = new google.maps.LatLng(lat, long);
//var address= data[i].Address
GetJsonResults(latlng, address)
}
}
run();
function GetJsonResults(latlng){
var service = new google.maps.places.PlacesService(map);
service.nearbySearch({
location: latlng,
radius: 50,
type: ['type']
},
function callback(results, status) {
var GoodTypes= [];
if (status === google.maps.places.PlacesServiceStatus.OK) {
for (var i = 0; i < results.length; i++) {
var type =results[i].types;
var name= results[i].name
console.log(results[i])
}
}
else {setTimeout(run(), 200)}
})
}