Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import json
import urllib2
city="bristol"
country="united kingdom"
citry = city.replace(' ', '+')
country = country.replace(' ', '+')
response = urllib2.urlopen("http://nominatim.openstreetmap.org/search?q="+city+"+"+country+"&format=json")
data = json.load(response)
data = data[0]
print(data['lon']+","+data['lat'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment