地理编码工具geocoder
地理编码工具geocoder,不同厂商的服务整合统一起来
地理编码
import geocoder
g = geocoder.google("1403 Washington Ave, New Orleans, LA 70130")
g = geocoder.arcgis(u"北京市海淀区上地十街10号")
g.latlng
输出为
[29.9287839, -90.08421849999999]
也可以查看完整的geojson
g.geojson
逆地理编码
#可以换成arcgis的服务试试
g = geocoder.google([29.9287839, -90.08421849999999], method='reverse')
print g
print g.address
print g.city
print g.state
print g.country
geocoder 的功能不止于此,它还可以查IP(包括自己的)
g = geocoder.ip('199.7.157.0')
print g.latlng
print g.city
g = geocoder.ip('me')
print g.latlng
print g.city
本文介绍了一个实用的地理编码工具geocoder,演示了如何使用该工具进行正向和逆向地理编码,包括地址到经纬度的转换及反向操作。此外还展示了通过IP地址获取地理位置信息的方法。
7792

被折叠的 条评论
为什么被折叠?



