I am trying to widen the search results returned by geocoding. I'm essentially createing a jquery ui autocomplete input like this http://tech.cibul.org/wp-content/uploads/2010/05/geocode/index.html (tutorial here http://tech.cibul.org/geocode-with-google-maps-api-v3/).
For example if I enter 'waterloo' in the location bar I get 1 option: Waterloo, ON, Canada.
What about all of the other Waterloos? http://en.wikipedia.org/wiki/Waterloo
This is the crux of the code:
$('input[name="location"]').autocomplete({
source: function(request, response) {
geocoder.geocode( {'address': request.term }, function(results, status) {
response($.map(results, function(item) {
return {
label: item.formatted_address,
value: item.formatted_address,
latitude: item.geometry.location.lat(),
longitude: item.geometry.location.lng()
}
}));
})
}
});