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);