ui.Map.setCenter

以指定縮放等級將地圖檢視畫面置中於指定座標。如果未提供縮放等級,系統會使用地圖上最近一次的縮放等級。

傳回這個 ui.Map。

用量傳回
Map.setCenter(lon, lat, zoom)ui.Map
引數類型詳細資料
這個:ui.mapui.Mapui.Map 執行個體。
lon數字中心經度 (以度為單位)。
lat數字中心緯度,以度為單位。
zoom號碼 (選填)縮放等級,範圍為 0 到 24。

範例

程式碼編輯器 (JavaScript)

// Define a ui.Map widget.
var map = ui.Map();

// Set the position and optional zoom level of the map. Latitude must be
// within [-85, 85].
map.setCenter({lon: -123.6, lat: 47.7, zoom: 9});
print(map);