-1
正如我目前所發現的,我可以在Google Place API中獲取所選區域的附近位置。我想知道如何在Google地圖或Places API中獲得所有鄉鎮/不同地區的選定區域?如何在Google Maps API中獲取所選國家/地區的所有城市或鄉鎮
正如我目前所發現的,我可以在Google Place API中獲取所選區域的附近位置。我想知道如何在Google地圖或Places API中獲得所有鄉鎮/不同地區的選定區域?如何在Google Maps API中獲取所選國家/地區的所有城市或鄉鎮
您可以使用類似於以下內容的代碼將搜索限制在某個國家/地區。
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places&key=your-key"></script>
<label for="city">
<input id="city" name="city">
</label>
<script>
var input = document.getElementById('city');
var options = {
types: ['(cities)'],
componentRestrictions: {country: "us"}
};
var searchBox = new google.maps.places.SearchBox(input,options);
</script>
更多代碼可以發現here