Python提供了可用于将Google地图中可用地址直接转换为地理坐标的模块。这有助于查找商户地址和查找不同地址的紧密度。
pygeocoder
模块提供了接收地址和地理编码的功能。使用以下命令通过pip安装此模块。
安装pygeocoder
pip install pygeocoder
查找公司地址
提交一个企业名称作为输入,而程序给出完整的地址作为输出。该模块在后台使用Google地图中的数据来检索结果。
from pygeocoder import Geocoder
business_name = "Workafexxxc city"
print "Searching %s" %business_name
results = Geocoder.geocode(business_name)
for result in results:
print result
当运行上面示例代码,得到以下结果:
Searching Workafexxxc city
Western pearl buildxxx y Rd,
Opposits naxxxx 500084, India