Created
August 25, 2011 18:16
-
-
Save bragil/1171352 to your computer and use it in GitHub Desktop.
Dado o endereço, obter localização, latitude e longitude
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
def dados_do_local(endereco): | |
""" | |
Dado o endereco, retorna o endereco processado, a latitude e a longitude do local. | |
Exemplo: | |
place, (lat, lng) = dados_do_local(endereco) | |
""" | |
from geopy import geocoders | |
if hasattr(settings, "EASY_MAPS_GOOGLE_KEY") and settings.EASY_MAPS_GOOGLE_KEY: | |
g = geocoders.Google(settings.EASY_MAPS_GOOGLE_KEY) | |
else: | |
g = geocoders.Google(resource='maps') | |
return g.geocode(endereco) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment