28 lines
789 B
Python
28 lines
789 B
Python
from geopy.geocoders import Nominatim
|
|
|
|
class AdressCoordinates:
|
|
def __init__(self, address):
|
|
self.addess = address
|
|
|
|
def open_Maps_by_address(self):
|
|
address = self.addess
|
|
if not address:
|
|
return
|
|
|
|
#try:
|
|
geolocator = Nominatim(user_agent="flet_Maps_app")
|
|
location = geolocator.geocode(address)
|
|
print(location)
|
|
if location:
|
|
latitude = location.latitude
|
|
longitude = location.longitude
|
|
Maps_url = f"https://www.google.com/maps/search/?api=1&query={latitude},{longitude}"
|
|
|
|
return {
|
|
'latitude' : latitude,
|
|
'longitude' : longitude,
|
|
'Maps_url': Maps_url
|
|
}
|
|
|
|
#except Exception as ex:
|
|
# print(ex) |