Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion geocoders/geonames.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from utils import simplejson, geocoder_factory
import urllib
from django.utils.http import urlencode

# http://www.geonames.org/export/geonames-search.html

def geocode(q):
data = simplejson.load(urllib.urlopen(
'http://ws.geonames.org/searchJSON?' + urllib.urlencode({
'http://ws.geonames.org/searchJSON?' + urlencode({
'q': q,
'maxRows': 1,
'lang': 'en',
Expand Down
3 changes: 2 additions & 1 deletion geocoders/google.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import urllib
from django.utils.http import urlencode
from utils import simplejson, geocoder_factory

# http://code.google.com/apis/maps/documentation/geocoding/index.html

def geocode(q, api_key):
json = simplejson.load(urllib.urlopen(
'http://maps.google.com/maps/geo?' + urllib.urlencode({
'http://maps.google.com/maps/geo?' + urlencode({
'q': q,
'output': 'json',
'oe': 'utf8',
Expand Down
3 changes: 2 additions & 1 deletion geocoders/multimap.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import urllib
from django.utils.http import urlencode
from utils import simplejson, geocoder_factory

# http://www.multimap.com/openapidocs/1.2/web_service/ws_geocoding.htm

def geocode(q, api_key):
base_url = 'http://developer.multimap.com/API/geocode/1.2/%s' % urllib.quote(api_key)
json = simplejson.load(urllib.urlopen(base_url + '?' + urllib.urlencode({
json = simplejson.load(urllib.urlopen(base_url + '?' + urlencode({
'qs': q,
'output': 'json'
})
Expand Down
3 changes: 2 additions & 1 deletion geocoders/nominatim.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import urllib
from django.utils.http import urlencode
from utils import simplejson, geocoder_factory

def geocode(q, email):
Expand All @@ -10,7 +11,7 @@ def geocode(q, email):
"""

json = simplejson.load(urllib.urlopen(
'http://nominatim.openstreetmap.org/search?' + urllib.urlencode({
'http://nominatim.openstreetmap.org/search?' + urlencode({
'q': q,
'format': 'json',
'email': email
Expand Down
3 changes: 2 additions & 1 deletion geocoders/placemaker.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from utils import make_nsfind, ET, geocoder_factory
import urllib
from django.utils.http import urlencode

# http://developer.yahoo.com/geo/placemaker/guide/api_docs.html

Expand All @@ -13,7 +14,7 @@ def geocode(q, api_key):
'appid': api_key,
}
et = ET.parse(urllib.urlopen(
'http://wherein.yahooapis.com/v1/document', urllib.urlencode(args))
'http://wherein.yahooapis.com/v1/document', urlencode(args))
)
place = find(et, 'ns:document/ns:placeDetails/ns:place')
if place is None:
Expand Down
3 changes: 2 additions & 1 deletion geocoders/yahoo.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from utils import make_nsfind, ET, geocoder_factory
import urllib
from django.utils.http import urlencode

# http://developer.yahoo.com/maps/rest/V1/geocode.html

def geocode(q, api_key):
find = make_nsfind({'ns': 'urn:yahoo:maps'})
args = {'location': q, 'appid': api_key}
url = 'http://local.yahooapis.com/MapsService/V1/geocode?%s' % urllib.urlencode(args)
url = 'http://local.yahooapis.com/MapsService/V1/geocode?%s' % urlencode(args)
et = ET.parse(urllib.urlopen(url))

result = find(et, '//ns:Result')
Expand Down