When autocompleting, it would be useful to bias the selection of addresses according to the current viewport:

if ($("#edit-from").is("input.form-text")) {
var input_from = document.getElementById('edit-from');
var ac_from = new google.maps.places.Autocomplete(input_from);
ac_from.bindTo('bounds', map);
google.maps.event.addListener(ac_from, 'place_changed', function() {
var place_from = ac_from.getPlace();
$("#edit-from").val(place_from.formatted_address);
showAddress();
});
}

Comments

munawar’s picture

hutch:

Thanks for changing the code so quickly on my other post re. public transport.

You beat me to it by a few minutes. I'll upload a relevant patch to this thread anyway.

Munawar

hutch’s picture

I've just given this patch a quick test, works a treat, I will be adding this next week, making it an option that can be set to Always on, Never on or on/off checkbox on the form. That should keep everyone happy.
Google are certainly keeping the features flying in, it does show that a bit of competition keeps the corporates on their toes ;-)

hutch’s picture

Status: Active » Needs review

Added viewport bias feature to dev, along with transit layer.