Fix some location handling bugs

This commit is contained in:
Ian Renton
2025-10-17 09:20:13 +01:00
parent 622fd38514
commit 06a0b55e65
2 changed files with 6 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
import copy import copy
import hashlib import hashlib
import json import json
import logging
from dataclasses import dataclass from dataclasses import dataclass
from datetime import datetime from datetime import datetime
@@ -220,7 +221,10 @@ class Spot:
self.dx_latitude = ll[0] self.dx_latitude = ll[0]
self.dx_longitude = ll[1] self.dx_longitude = ll[1]
if self.dx_latitude and self.dx_longitude and not self.dx_grid: if self.dx_latitude and self.dx_longitude and not self.dx_grid:
self.dx_grid = latlong_to_locator(self.dx_latitude, self.dx_longitude, 8) try:
self.dx_grid = latlong_to_locator(self.dx_latitude, self.dx_longitude, 8)
except:
logging.debug("Invalid lat/lon received for spot")
if self.dx_latitude: if self.dx_latitude:
self.dx_location_source = "SPOT" self.dx_location_source = "SPOT"

View File

@@ -64,7 +64,7 @@ class ParksNPeaks(HTTPSpotProvider):
for row in siota_dr: for row in siota_dr:
if row["SILO_CODE"] == spot.sig_refs[0]: if row["SILO_CODE"] == spot.sig_refs[0]:
spot.dx_latitude = float(row["LAT"]) spot.dx_latitude = float(row["LAT"])
spot.dx_longitude = float(row["LON"]) spot.dx_longitude = float(row["LNG"])
spot.dx_grid = row["LOCATOR"] spot.dx_grid = row["LOCATOR"]
break break