3***@qq.com
3***@qq.com
  • 发布:2025-04-02 11:55
  • 更新:2025-04-02 14:02
  • 阅读:161

各们大佬,为什么我通过“uni.getLocation”获取海拔高度时返回为0,获取不了海拔高度.

分类:HBuilderX

通过“uni.getLocation”获取海拔高度时返回为null


  • ,获取不了*海拔高度.代码信息如下:
    //获取位置信息;
    getLocation() {
    uni.getLocation({
    type: 'gcj02',//'wgs84',//'gcj02',// 使用国测局坐标系
    altitude:true,
    //geocode: true,
    isHighAccuracy: true, // 开启高精度定位
    success: (res) => {
    console.log(res)
    console.log('Speed:', res.speed); // 速度,单位m/s
    console.log('Altitude:', res.altitude); // 高度,单位m(如果请求了高度信息)
    this.latitude = res.latitude; // 纬度
    this.longitude = res.longitude; // 经度
    console.log('纬度:', this.latitude);
    console.log('经度:', this.longitude);
    //this.turnAddress();

            },  
            fail: (err) => {  
                console.log(err)  
                console.error('获取位置失败', err);  
            }  
        });  
        },  

    返回信息:
    11:52:12.657 Altitude: null
    11:52:13.164 纬度: [number] 39.901403
    11:52:13.664 经度: [number] 116.406242

2025-04-02 11:55 负责人:无 分享
已邀请:
3***@qq.com

3***@qq.com (作者)

H5项目

要回复问题请先登录注册