用户登录
用户注册

分享至

用于从美国城市名称中获取纬度和经度的 Python 模块

  • 作者: 那晚越女说我?
  • 来源: 51数据库
  • 2023-01-31

问题描述

我正在寻找一个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))
软件
前端设计
程序设计
Java相关