Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

urllib #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions coordTransform_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def geocode(self, address):
'key': self.api_key,
'city': '全国',
'address': address}
geocoding = urllib.urlencode(geocoding)
ret = urllib.urlopen("%s?%s" % ("http://restapi.amap.com/v3/geocode/geo", geocoding))
geocoding = urllib.parse.urlencode(geocoding)
ret = urllib.request.urlopen("%s?%s" % ("http://restapi.amap.com/v3/geocode/geo", geocoding))

if ret.getcode() == 200:
res = ret.read()
Expand Down Expand Up @@ -170,6 +170,6 @@ def out_of_china(lng, lat):
result5 = bd09_to_wgs84(lng, lat)
result6 = wgs84_to_bd09(lng, lat)

g = Geocoding('API_KEY') # 这里填写你的高德api的key
g = Geocoding('key') # 这里填写你的高德api的key
result7 = g.geocode('北京市朝阳区朝阳公园')
print result1, result2, result3, result4, result5, result6, result7
print (result1, result2, result3, result4, result5, result6, result7)