2014-01-18 140 views
0

如何限制Google Places API搜索的距離?他找到離我很遠的地方,我想限制從我到這個地方的距離。如何限制Google Places API搜索的距離?

+0

歡迎來到Stack Overflow。你看過Places API的文檔嗎?如果你能顯示你用來查詢API的代碼,這對於其他人來說更容易再現,這將是非常好的。 – simbabque

回答

0
var input = document.getElementById('id'); 
    var autocompleteOptions = { 
    //types: ['(cities)'], 
    componentRestrictions: {country: "us"} 
    }; 

var autocomplete = new google.maps.places.Autocomplete(input,autocompleteOptions);