def geocode(address):
"""
????geocoding????????????
:param address:???????
:return:
"""
geocoding = {'s': 'rsv3',
'key': key,
'city': '??',
'address': address}
res = requests.get(
"http://restapi.amap.com/v3/geocode/geo", params=geocoding)
if res.status_code == 200:
json = res.json()
status = json.get('status')
count = json.get('count')
if status == '1' and int(count) >= 1:
geocodes = json.get('geocodes')[0]
lng = float(geocodes.get('location').split(',')[0])
lat = float(geocodes.get('location').split(',')[1])
return [lng, lat]
else:
return None
else:
return None
CoordinateTransferService.py 文件源码
python
阅读 30
收藏 0
点赞 0
评论 0
评论列表
文章目录