使用python实现地理位置查询经纬度

地理编码工具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
  • 5
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值