我正在使用帶有 Angular 的 google Maps API,當我一直縮小時,我看到了這個:

這應該說“澳大利亞”而不是大洋洲。有沒有辦法改變它?
uj5u.com熱心網友回復:
首先,您要將地圖中心設定為澳大利亞
所以像: const center = { lat: -25.363, lng: 131.044 };
您還可以設定邊界限制。然后設定縮放級別,使螢屏適合整個國家。
所以 JS 代碼看起來像這樣:
const center = { lat: -25.363, lng: 131.044 };
const zoom = 4;
this.map = new google.maps.Map(this.mapDiv.nativeElement, {
center: center,
zoom: zoom,
minZoom: zoom - 3,
maxZoom: zoom 3,
disableDefaultUI: true,
restriction: {
latLngBounds: {
north: -10,
south: -40,
east: 160,
west: 100,
},
},
});
您只需要使用縮放、中心、限制值來滿足您的需要。
這方面的檔案在這里:
https://developers.google.com/maps/documentation/javascript/interaction
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/405802.html
標籤:
