Skip to content

Instantly share code, notes, and snippets.

@thampiman
Last active January 30, 2017 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thampiman/8ae6dd43a86d90a3d575a0c724dabf50 to your computer and use it in GitHub Desktop.
Save thampiman/8ae6dd43a86d90a3d575a0c724dabf50 to your computer and use it in GitHub Desktop.
# Install library using: pip install reverse_geocoder
import reverse_geocoder as rg
coordinates = (51.5214588,-0.1729636), (9.936033, 76.259952), (37.38605,-122.08385)
result = rg.search(coordinates)
"""
Output will be a list of dicts:
[{'name': 'Bayswater',
'cc': 'GB',
'lat': '51.51116',
'lon': '-0.18426',
'admin1': 'England',
'admin2': 'Greater London'},
{'name': 'Cochin',
'cc': 'IN',
'lat': '9.93988',
'lon': '76.26022',
'admin1': 'Kerala',
'admin2': 'Ernakulam'},
{'name': 'Mountain View',
'cc': 'US',
'lat': '37.38605',
'lon': '-122.08385',
'admin1': 'California',
'admin2': 'Santa Clara County'}]
"""
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment