Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unexpected results - Google Autocomplete against yorkshire

I am getting unexpected results against 'Yorkshire' using Google Maps auto-complete API. I have filtered the results to only display regions of UK. Please help me

Following are the results I am getting while search for Yorkshire:

  • Yorkshire du Nord, Royaume-Uni
  • Yorkshire Oriental, Reino Unido
  • Yorkshire del Sur, Reino Unido

Below is the code:

<script src="http://maps.google.com/maps?file=api&v=2&key=MYGooGleAPiKey" type="text/javascript"></script><script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&libraries=places&language=en"></script><script>
$(function() {

    var options = {
        types: ['(regions)'],
        componentRestrictions: {country: 'uk'},
        region: ['(GB)']
    };

    var autocomplete = new google.maps.places.Autocomplete($("#txt_search")[0], options);

    google.maps.event.addListener(autocomplete, 'place_changed', function() {
        var place = autocomplete.getPlace();
        //console.log(place.address_components);
    });
});</script> 
like image 706
user1427597 Avatar asked Nov 14 '22 04:11

user1427597


1 Answers

It seems to be a bug in the API, see https://code.google.com/p/gmaps-api-issues/issues/detail?id=8619 and star if you want to see them fix it.

like image 172
Peet Avatar answered Nov 16 '22 04:11

Peet