高德地图地理编码与逆编码

高德地图地理编码与逆编码

  • 获取地理位置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
uni.request({
url: 'https://restapi.amap.com/v3/geocode/regeo',
method: 'GET',
data: {
key: 'your key',
location: '116.481488,39.990464',
},
header: {
'Content-Type': 'application/x-www-form-urlencoded',
},
success: res => {
console.log(res)
},
})
  • 获取经纬度
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
uni.request({
url: 'https://restapi.amap.com/v3/geocode/geo',
method: 'GET',
data: {
key: 'your key',
address: '北京市朝阳区阜通东大街6号',
city: '北京',
},
header: {
'Content-Type': 'application/x-www-form-urlencoded',
},
success: res => {
console.log(res)
},
})