Created
July 31, 2010 09:57
-
-
Save emre/502001 to your computer and use it in GitHub Desktop.
google maps'te arama icin ufak bir python wrapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf8 -*- | |
import urllib, simplejson | |
class GoogleMapsWrapper(object): | |
def __init__(self, apiKey): | |
self.api_key = apiKey | |
def search(self, address): | |
""" | |
adres formatı: mahalle/sokak/ilçe/il | |
""" | |
params = urllib.urlencode({ | |
"q" : "%s" % address, | |
"output" : "json", | |
"oe" : "utf8", | |
"sensor" : "true_or_false", | |
"key" : self.api_key, | |
}) | |
http_request = urllib.urlopen("http://maps.google.com/maps/geo?%s" % params) | |
return self.parse_result(http_request.read()) | |
def parse_result(self, result): | |
data = simplejson.loads(result) | |
return data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment