I want my search to only return hits within the map/viewport. I zoom in over Britain and search for London with the map bounds, but the response also return 3 hits in the US. How do I limit the search?
Code:
function codeAddress(){
geocoder = new google.maps.Geocoder();
var address = document.getElementById("inputAddress").value;
var bounds = map.getBounds();
geocoder.geocode({address: address, bounds: bounds}, function(results, status){
if(status == google.maps.GeocoderStatus.OK){
// put markers on each hit
}
});
}