0

Reading the documentation of google maps, geocoding service, I see that to restrict the search results, for example in the country, I have to enter

http://maps.googleapis.com/maps/api/js?key=MY_API_KEY&components=country:IT&sensor=true

But it does not work! If I type in "Via" returns results like:

results

I forget to do something?

4

1 回答 1

0

尝试这个

var input = document.getElementById('searchTextField');
var options = {
types: ['(cities)'],
componentRestrictions: {country: 'fr'}
};

autocomplete = new google.maps.places.Autocomplete(input, options);
于 2013-04-23T05:59:13.557 回答