高德地图使用逆地理编码服务

  1. 进入高德地图开发者平台申请web服务,并获取web服务生成的key
  2. 下面是高德地图官网的逆地理编码服务使用说明
  3. https://lbs.amap.com/api/webservice/guide/api/georegeo/
getAddressByLocation(latitude, longitude) {
  const key = 'key';  // 高德地图key密钥
  const url = 'https://restapi.amap.com/v3/geocode/regeo?output=json&location=' + latitude + ',' + longitude + '&key=' + key;
	uni.request({
		url: url,
	}).then(res=>{
		console.log(res.data)
		let address = res.data.regeocode.formatted_address // 获取的地址
		
	})
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
高德地图的批量地理编码可以使用其Web API实现。以下是实现的大致步骤: 1. 准备需要地理编码的经纬度坐标数据。 2. 通过高德地图Web API发送HTTP请求,获取地理编码结果。 3. 解析返回的JSON格式数据,提取地址信息。 4. 保存地址信息到文件或数据库中。 以下是一个Python示例代码,实现了高德地图批量地理编码的功能: ```python import requests import json # 高德地图Web API的请求URL url = 'https://restapi.amap.com/v3/geocode/regeo' # 高德地图Web API的开发者密钥 key = 'your_api_key' # 待地理编码的经纬度坐标数据 coordinates = [ {'lng': 116.481488, 'lat': 39.990464}, {'lng': 116.417901, 'lat': 39.921988}, {'lng': 121.47876, 'lat': 31.238176} ] # 批量地理编码 for coord in coordinates: params = { 'location': '{},{}'.format(coord['lng'], coord['lat']), 'key': key, 'output': 'JSON', 'radius': 1000, 'extensions': 'base' } response = requests.get(url, params) result = json.loads(response.text) if result['status'] == '1': address = result['regeocode']['formatted_address'] print(address) else: print('地理编码失败') ``` 在上述示例代码中,需要将`your_api_key`替换为自己的高德地图Web API开发者密钥。另外,`coordinates`变量中的经纬度坐标可以根据实际情况进行修改。最后,将地理编码结果保存到文件或数据库中可以使用Python内置的文件操作或数据库API实现。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值