标签:telematics
h1. 准备工作
安装pytyon, pip, geopy
> wget -N https://bootstrap.pypa.io/get-pip.py
> python get-pip.py
> pip install geopy pygeoip
h2. 百度地图
编写如下 gbaidu.py 脚本
# -*- coding: utf-8 -*- #!/usr/bin/python from geopy.geocoders import baidu apikey = '1234567' #从网站申请 http://lbsyun.baidu.com/apiconsole/key?application=key g = baidu.Baidu(apikey) print 'query demo' a = g.geocode("上海市 人民广场") print(a.latitude,a.longitude) b = g.reverse("31.236004921296, 121.47894508654") print b.address
h2. 必应地图
编写如下gbing.py脚本
# -*- coding: utf-8 -*- #!/usr/bin/python from geopy.geocoders import bing ak = '1234567' #从网站申请 https://msdn.microsoft.com/en-us/library/ff428642.aspx#keyMigration g = bing.Bing(ak) print 'query demo' a = g.geocode("上海市 人民广场") print(a.latitude,a.longitude) b = g.reverse("31.236004921296, 121.47894508654") print b.address
>python gbing.py
参考链接
1. http://blog.csdn.net/killmice/article/details/8633606目前上面两个脚本都没有结果,相信不是网速的原因,谁能翻墙帮我试一下。
get geocoding with geopy from baidu and bing
标签:telematics
原文地址:http://blog.csdn.net/spacecraft/article/details/43309447