Python Network Programming 简明教程
Python - Google Maps
Python 提供了可以直接将谷歌地图中的地址转换为地理坐标的模块。在查找营业地址和定位不同地址的接近度时很有用。
我们使用名为 pygeocoder 提供接收地址和地理编码功能的模块。此模块通过以下命令通过 pip 安装。
Finding Business Address
我们提交一个商家名称作为输入,程序会给出完整的地址作为输出。此模块使用谷歌地图中的数据在后台检索结果。
from pygeocoder import Geocoder
business_name = "Workafella Business Centre - Hitec city"
print "Searching %s" %business_name
results = Geocoder.geocode(business_name)
for result in results:
print result
当我们运行以上程序时,我们得到以下输出:
Searching Workafella Business Centre - Hitec city
Western pearl building 1st floor, Hitech City Rd,
Opposite HDFC Bank, Kondapur, Hyderabad, Telangana 500084, India