码迷,mamicode.com
首页 > 编程语言 > 详细

Python 对城市进行地理编码

时间:2014-08-20 07:06:06      阅读:179      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!