首页 > 代码库 > Python 对城市进行地理编码
Python 对城市进行地理编码
CODE:
#!/usr/bin/python # -*- coding: utf-8 -*- ''' Created on 2014-8-20 @author: guaguastd @name: geocode_location_bing.py ''' from geopy import geocoders GEO_APP_KEY = '' g = geocoders.Bing(GEO_APP_KEY) for city in ["Beijing", "Nashville", "NewYork"]: print g.geocode(city, exactly_one=False)
RESULT:
[Location(Beijing, Beijing, China 39 54m 0.0s N, 116 23m 0.0s E)] [Location(Nashville, TN, United States 36 10m 0.0s N, 86 47m 0.0s W), Location(Nashville, IN, United States 39 13m 0.0s N, 86 15m 0.0s W), Location(Nashville, IL, United States 38 21m 0.0s N, 89 23m 0.0s W), Location(Nashville, AR, United States 33 57m 0.0s N, 93 51m 0.0s W), Location(Nashville, NC, United States 35 58m 0.0s N, 77 58m 0.0s W)] [Location(New York, NY, United States 40 47m 0.0s N, 73 50m 0.0s W), Location(New York, NY, United States 40 43m 0.0s N, 74 0m 0.0s W), Location(New York, MO, United States 39 41m 0.0s N, 93 55m 0.0s W), Location(New York, England, United Kingdom 53 5m 0.0s N, 0 8m 0.0s W), Location(New York, England, United Kingdom 54 4m 0.0s N, 1 42m 0.0s W)]
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。