目录

1.2.5 获取地理位置

优质
小牛编辑
120浏览
2023-12-01

地理位置

获取地理位置信息

Tida.geolocation.getCurrentPosition(function(result) {
    if (result.errorCode) { // data.errorCode 错误码 只有为0时才是成功的
        console.error(result.errorCode, result.errorMessage);
        return;
    }
});

data 格式:

{
    coords: {
        latitude: 30.282191 // 纬度,浮点数
        longitude: 120.019423 // 经度 ,浮点数
    },
    heading: -1, // 方向
    speed: -1, // 速度
    accuracy: 65, // 精度
    altitude: 27.860872, // 海拔
    altitudeAccuracy: 13.644432
}