MapContext.getCenterLocation
收藏
我的收藏

基础库 1.63.0 开始支持本方法,这是一个异步方法。

获取当前地图中心的经纬度,返回的是 `gcj02` 坐标系,可以用于 tt.openLocation()

前提条件
业务背景
使用限制
注意事项
支持沙盒
相关教程

语法

MapContext.getCenterLocation(options)

参数说明

options 为 object 类型,属性如下:

属性名类型默认值必填说明最低支持版本
successfunction
接口调用成功的回调函数
1.63.0
failfunction
接口调用失败的回调函数
1.63.0
completefunction
接口调用结束的回调函数(调用成功、失败都会执行)
1.63.0

回调成功

object 类型,属性如下:

属性名类型说明最低支持版本
errMsgstring
"MapContext.getCenterLocation:ok"
1.63.0
longitudenumber
经度
1.63.0
latitudenumber
纬度
1.63.0

回调失败

object 类型,属性如下:

属性名类型说明最低支持版本
errMsgstring
"MapContext.getCenterLocation:fail" + 详细错误信息
1.63.0

扫码体验

请使用字节宿主APP扫码

代码示例