用于从美国城市名称中获取纬度和经度的 Python 模块 [英] Python module for getting latitude and longitude from the name of a US city

查看:29
本文介绍了用于从美国城市名称中获取纬度和经度的 Python 模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个python模块,它可以将城市名称作为输入并返回输入的纬度和经度.

I am looking for a python module which can take in the name of the city as the input and return the latitude and longitude of the input.

推荐答案

看看geopy.在入门"文档中它显示:

Have a look at geopy. In the "getting started" documentation it shows:

>>> from geopy import geocoders  
>>> gn = geocoders.GeoNames()

>>> print gn.geocode("Cleveland, OH 44106")
(u'Cleveland, OH, US', (41.4994954, -81.6954088))

>>> gn.geocode("Cleveland, OH", exactly_one=False)[0]
(u'Cleveland, OH, US', (41.4994954, -81.6954088))

这篇关于用于从美国城市名称中获取纬度和经度的 Python 模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆