javascript - The problem of converting WeChat's location coordinates into coordinates that can be recognized by Baidu
phpcn_u1582
phpcn_u1582 2017-05-19 10:39:38
0
1
796

The address I converted is
"http://api.map.baidu.com/geoconv/v1/?coords=" longitude "," latitude "&from=1&to=5&ak=" myak
But The transferred coordinates used on Baidu Map have positional deviations. Have you ever encountered this situation?
WeChat uses

to obtain coordinates.
wx.getLocation({
    type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
    success: function (res) {
        var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
        var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
        var speed = res.speed; // 速度,以米/每秒计
        var accuracy = res.accuracy; // 位置精度
    }
});
phpcn_u1582
phpcn_u1582

reply all(1)
某草草

There is no problem in converting GPS coordinates to Baidu coordinates using Baidu’s API, there will be no errors,

http://api.map.baidu.com/geoconv/v1/?coords=120.105419,31.269587&from=1&to=5&ak=你的密钥
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!