首页 > 编程语言 > 详细

Python 对城市进行地理编码

时间:2014-08-20 07:06:06      阅读:385      评论:0      收藏:0      [点我收藏+]

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)]


Python 对城市进行地理编码,布布扣,bubuko.com

Python 对城市进行地理编码

原文:http://blog.csdn.net/guaguastd/article/details/38700787

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!