Skip to content

python版地理编码的查询链接有误 #33

Description

@git190

原链接为:
geocoding = {'s': 'rsv3', 'key': self.api_key, 'city': '全国', 'address': address} geocoding = urllib.parse.urlencode(geocoding) ret = urllib.request.urlopen("%s?%s" % ("http://restapi.amap.com/v3/geocode/geo", geocoding))
(举例:[http://restapi.amap.com/v3/geocode/geos=rsv3&key=xxx&city=%广州&address=%君紫花园)]
查询结果为:
{ "status": "0",
"info": "INVALID_USER_KEY",
"infocode": "10001"}

正确链接为:[http://restapi.amap.com/v3/geocode/geo?key=xxx&city=%广州&address=%君紫花园)]
geocoding = {'key': self.api_key, 'city': city, 'address': address} geocoding = urllib.parse.urlencode(geocoding) ret = urllib.request.urlopen("%s?%s" % ("http://restapi.amap.com/v3/geocode/geo?", geocoding))
查询结果为:
{
"status": "1",
"info": "OK",
"infocode": "10000",
"count": "1",
"geocodes": [
{
"formatted_address": "广东省广州市天河区君紫花园",
"country": "中国",
"province": "广东省",
"citycode": "020",
"city": "广州市",
"district": "天河区",
"township": [],
"neighborhood": {
"name": [],
"type": []
},
"building": {
"name": [],
"type": []
},
"adcode": "440106",
"street": [],
"number": [],
"location": "113.344832,23.127699",
"level": "兴趣点"
}
]
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions