// 获取经纬度 省市区 详细地址
uni.getLocation({
type: 'gcj02',
geocode: true,
success: function(res) {
console.log('定位信息:'+JSON.stringify(res));
}
});
结果:
定位信息:{"type":"gcj02","altitude":0,"latitude":22.77997076667967,"longitude":113.88851889306451,"speed":0,"accuracy":30,"address":{"country":"","province":"","city":"","district":"","street":"","streetNum":"","poiName":"","cityCode":""},"errMsg":"getLocation:ok"}
省市区数据都是空的,这是为啥???
2 个回复
爱豆豆 - 办法总比困难多
是App端吗?只有app端会返回
或者直接使用 高德地图的 逆地理编码api来获取省市区数据
文档地址:https://lbs.amap.com/api/webservice/guide/api/georegeo#t5
吃俺老孙一棒 - 狼行千里吃肉,狗行千里吃屎
只有app端才会进行逆编码返回地址信息,app端云打包需要申请地图key并配置在manifest定位里才能正常返回