Geocoding autocomplete bias not working

Posted by chris on Stack Overflow See other posts from Stack Overflow or by chris
Published on 2012-03-23T11:20:04Z Indexed on 2012/03/25 23:29 UTC
Read the original article Hit count: 304

I'm using the following code to get the autocomplete functionality for an address input box using Google Maps API v3:

function initializeAutocomplete() {

var defaultBounds = new google.maps.LatLngBounds(
    new google.maps.LatLng(1.484016,103.575212),
    new google.maps.LatLng(1.233592,104.033618));

var input = document.getElementById('destStreet');
var myOptions = {bounds: defaultBounds, types: ['geocode']};

autocomplete = new google.maps.places.Autocomplete(input, myOptions);
}

The problem is that biasing doesn't seem to work as the first results are usually not relevant to the defined bounds (a country). I've seen a few apps working fine, so I'm wondering where the problem is.

I came across the JQuery autocomplete plugin (http://code.google.com/p/geo-autocomplete/) which would seem like a good alternative since it has a region filter, but I'm unable to "install it" or use it because of my very limited knowledge (I learn by example).

Could you please help me getting more relevant results with the above code or guide me through the implementation of the JQuery alternative? Of course I'm very open to other suggestions as well.

© Stack Overflow or respective owner

Related posts about google-maps

Related posts about jquery-autocomplete