query_region.find({}, function(err,getoverhaulhouselistbyaoguids){
var i = 80;
var z = 97;
for(var l = 0; l < i; l++){
for(n = 0; n < z; n++){
if(getoverhaulhouselistbyaoguids == undefined){
console.log('asdsads');
}
const jsonAdressAndCountPeople = [];
jsonAdressAndCountPeople.push(
getoverhaulhouselistbyaoguids[l]['data'][n].address ,
getoverhaulhouselistbyaoguids[l]['data'][n].totalPpl );
var language = "ru";
var city = "Алтайский край";
var street = getoverhaulhouselistbyaoguids[l]['data'][n].address;
var clearStreet =street.replace(/([а-яa-zё-]+).*?(\s|$)/gi, (r, s) => s.length <= 4 ? '' : r);
var clearStreet = clearStreet.replace(",", "");
var clearStreet = clearStreet.replace(".", "");
var format = "jsonv2";
var cityCode = encodeURIComponent(city);
var streetCode = encodeURIComponent(clearStreet);
var get = "https://nominatim.openstreetmap.org/search?q="+streetCode+"&format=json&polygon=1&addressdetails=1";
axios.get(get)
.then(function (response) {
console.log(response);
res.setHeader('Content-Type', 'application/json');
//var data = response;
var data = res.end(response.query);
var lat = response["data"][0]['lat'];
var lon = response["data"][0]['lon'];
var display_name = response["data"][0]['display_name'];
var jsonArr = [];
jsonArr.push({
0: lat,
1: lon,
2: display_name
});
console.log(jsonArr);
return res.end('index', { data : data, q :q });
})
.catch(function (error) {
console.log('error');
console.log(error);
});
}
}
});
}
address
. Вообще-то в сообщении об ошибке обычно есть имя файла и номер строки. obj.address = ...