Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # pip install geopy
- from geopy.geocoders import Yandex
- import json
- geolocator = Yandex(lang='pt_BR')
- city = "sobral"
- country = "BR"
- location = geolocator.geocode(str(city + ',' + country))
- if location != None:
- # print(json.dumps(location.raw, indent=4))
- print(location.address)
- print("latitude: {}".format(location.latitude))
- print("longitude: {}".format(location.longitude))
- else:
- print(location)
- location = geolocator.geocode("Rio Branco, Acre, Brasil")
- print("latitude: {}".format(location.latitude))
- print("longitude: {}".format(location.longitude))
- location = geolocator.reverse("-9.969687, -67.825427", exactly_one=True)
- print(location.address)
Add Comment
Please, Sign In to add comment