Update server.py
Browse files
server.py
CHANGED
@@ -207,8 +207,8 @@ async def get_location_coordinates(village: str, district: str) -> tuple[list, s
|
|
207 |
# Try village coordinates first
|
208 |
try:
|
209 |
village_location = await geographic_tools.reverse_geocode(village)
|
210 |
-
if "error" not in village_location and "
|
211 |
-
location_coords = [village_location["
|
212 |
location_source = f"village_{village}"
|
213 |
logger.info(f"Using village coordinates for {village}: {location_coords}")
|
214 |
except Exception as e:
|
@@ -218,8 +218,8 @@ async def get_location_coordinates(village: str, district: str) -> tuple[list, s
|
|
218 |
if not location_coords:
|
219 |
try:
|
220 |
district_location = await geographic_tools.reverse_geocode(district)
|
221 |
-
if "error" not in district_location and "
|
222 |
-
location_coords = [district_location["
|
223 |
location_source = f"district_{district}"
|
224 |
logger.info(f"Using district coordinates for {district}: {location_coords}")
|
225 |
except Exception as e:
|
|
|
207 |
# Try village coordinates first
|
208 |
try:
|
209 |
village_location = await geographic_tools.reverse_geocode(village)
|
210 |
+
if "error" not in village_location and "latitude" in village_location:
|
211 |
+
location_coords = [village_location["latitude"], village_location["longitude"]]
|
212 |
location_source = f"village_{village}"
|
213 |
logger.info(f"Using village coordinates for {village}: {location_coords}")
|
214 |
except Exception as e:
|
|
|
218 |
if not location_coords:
|
219 |
try:
|
220 |
district_location = await geographic_tools.reverse_geocode(district)
|
221 |
+
if "error" not in district_location and "latitude" in district_location:
|
222 |
+
location_coords = [district_location["latitude"], district_location["longitude"]]
|
223 |
location_source = f"district_{district}"
|
224 |
logger.info(f"Using district coordinates for {district}: {location_coords}")
|
225 |
except Exception as e:
|