Skip to content

Instantly share code, notes, and snippets.

@emre
Created July 31, 2010 09:57
Show Gist options
  • Save emre/502001 to your computer and use it in GitHub Desktop.
Save emre/502001 to your computer and use it in GitHub Desktop.
google maps'te arama icin ufak bir python wrapper
# -*- 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