uploadet project
This commit is contained in:
@@ -35,12 +35,24 @@ def open_pauses_popup(screen_instance, project_name, RESOURCES_FOLDER, on_save_c
|
||||
try:
|
||||
geolocator = Nominatim(user_agent="traccar_animation")
|
||||
location = geolocator.reverse((lat, lon), exactly_one=True, radius=50, timeout=10)
|
||||
if location and location.address:
|
||||
return location.address
|
||||
else:
|
||||
return "Unknown place"
|
||||
except Exception as e:
|
||||
return "Unknown place"
|
||||
if not location or not location.raw or not location.address:
|
||||
return f"{lat:.5f}, {lon:.5f}"
|
||||
|
||||
address = location.raw.get('address', {})
|
||||
# 1. Place or location nearby (amenity, attraction, building, etc.)
|
||||
for key in ['attraction', 'building', 'amenity', 'shop', 'leisure', 'tourism', 'place', 'public_building']:
|
||||
if key in address:
|
||||
return address[key]
|
||||
# 2. Street name and number
|
||||
if 'road' in address and 'house_number' in address:
|
||||
return f"{address['road']} {address['house_number']}"
|
||||
# 3. Road name
|
||||
if 'road' in address:
|
||||
return address['road']
|
||||
# 4. Fallback: lat/lon
|
||||
return f"{lat:.5f}, {lon:.5f}"
|
||||
except Exception:
|
||||
return f"{lat:.5f}, {lon:.5f}"
|
||||
|
||||
# Main layout for popup (vertical)
|
||||
layout = BoxLayout(orientation='vertical', spacing=14, padding=14)
|
||||
|
||||
Reference in New Issue
Block a user