var g = new google.maps.Geocoder();
var ne = new google.maps.LatLng(55.970724,37.922058);
var sw = new google.maps.LatLng(55.545727,37.382355);
var ba = new google.maps.LatLngBounds(sw, ne);
var str = document.getElementById('place').value;
var d = document.getElementById('answer');
g.geocode({address: str, language: 'ru', region: 'ru', bounds: ba},
function (results, status) {
for (var i in results) {
var p = document.createElement('p');
p.innerHTML = results[i].formatted_address;
d.appendChild(p);
}
});
What am I doing wrong?
If you want results from one country only, the most robust solution is
to concatenate the country name to the request.
query += " ru";
You can also parse the country code from the response and accept/
discard a result by that. It is a bit tricky with the structure of V3
geocode response object.
http://koti.mbnet.fi/ojalesa/geocode/prettygeocode_v3.htm