Improvements to getting lat/lon from spots. Closes #123

This commit is contained in:
Ian Renton
2026-08-08 08:19:51 +01:00
parent 8d28a29f82
commit 985646bb94
15 changed files with 38 additions and 29 deletions
+8 -6
View File
@@ -34,6 +34,10 @@ class GMA(HTTPSpotProvider):
if "RCD" in http_response.json():
for source_spot in http_response.json()["RCD"]:
# Convert to our spot format
# Seen GMA spots with no (or empty) lat/lon
lat = float(source_spot["LAT"]) if (source_spot["LAT"] and source_spot["LAT"] != "") else None
lon = float(source_spot["LON"]) if (source_spot["LON"] and source_spot["LON"] != "") else None
spot = Spot(source=self.name,
dx_call=source_spot["ACTIVATOR"].upper(),
de_call=source_spot["SPOTTER"].upper(),
@@ -43,14 +47,12 @@ class GMA(HTTPSpotProvider):
# Filter out some weird mode strings
mode=source_spot["MODE"].upper() if "<>" not in source_spot["MODE"] else None,
comment=source_spot["TEXT"],
sig_refs=[SIGRef(id=source_spot["REF"], sig="", name=source_spot["NAME"])],
sig_refs=[SIGRef(id=source_spot["REF"], sig="", name=source_spot["NAME"], latitude=lat,
longitude=lon)],
time=datetime.strptime(source_spot["DATE"] + source_spot["TIME"], "%Y%m%d%H%M").replace(
tzinfo=pytz.UTC).timestamp(),
# Seen GMA spots with no (or empty) lat/lon
dx_latitude=float(source_spot["LAT"]) if (
source_spot["LAT"] and source_spot["LAT"] != "") else None,
dx_longitude=float(source_spot["LON"]) if (
source_spot["LON"] and source_spot["LON"] != "") else None,
dx_latitude=lat,
dx_longitude=lon,
qrt=source_spot["QRG"] == "QRT")
# GMA doesn't give what programme (SIG) the reference is for until we separately look it up.
+2 -1
View File
@@ -59,7 +59,8 @@ class HEMA(HTTPSpotProvider):
mode=freq_mode_match.group(2).upper(),
comment=spotter_comment_match.group(2),
sig="HEMA",
sig_refs=[SIGRef(id=spot_items[3].upper(), sig="HEMA", name=spot_items[4])],
sig_refs=[SIGRef(id=spot_items[3].upper(), sig="HEMA", name=spot_items[4],
latitude=float(spot_items[7]), longitude=float(spot_items[8]))],
time=datetime.strptime(spot_items[0], "%d/%m/%Y %H:%M").replace(
tzinfo=pytz.UTC).timestamp(),
dx_latitude=float(spot_items[7]),
+2 -1
View File
@@ -29,7 +29,8 @@ class POTA(HTTPSpotProvider):
mode=source_spot["mode"].upper(),
comment=source_spot["comments"],
sig="POTA",
sig_refs=[SIGRef(id=source_spot["reference"], sig="POTA", name=source_spot["name"])],
sig_refs=[SIGRef(id=source_spot["reference"], sig="POTA", name=source_spot["name"],
latitude=source_spot["latitude"], longitude=source_spot["longitude"])],
time=datetime.strptime(source_spot["spotTime"], "%Y-%m-%dT%H:%M:%S").replace(
tzinfo=pytz.UTC).timestamp(),
dx_grid=source_spot["grid6"],
+5 -3
View File
@@ -19,8 +19,6 @@ class SOTA(HTTPSpotProvider):
# The actual data lookup all happens after parsing and checking the epoch.
EPOCH_URL = "https://api-db2.sota.org.uk/api/spots/epoch"
SPOTS_URL = "https://api-db2.sota.org.uk/api/spots/60/all/all"
# SOTA spots don't contain lat/lon, we need a separate lookup for that
SUMMIT_URL_ROOT = "https://api-db2.sota.org.uk/api/summits/"
def __init__(self, provider_config):
super().__init__("SOTA", provider_config, self.EPOCH_URL, self.POLL_INTERVAL_SEC)
@@ -51,8 +49,12 @@ class SOTA(HTTPSpotProvider):
mode=source_spot["mode"].upper(),
comment=source_spot["comments"],
sig="SOTA",
sig_refs=[SIGRef(id=source_spot["summitCode"], sig="SOTA", name=source_spot["summitName"],
sig_refs=[SIGRef(id=source_spot["summitCode"], sig="SOTA",
name=source_spot["summitName"], latitude=source_spot["latitude"],
longitude=source_spot["longitude"],
activation_score=source_spot["points"])],
dx_latitude=source_spot["latitude"],
dx_longitude=source_spot["longitude"],
time=datetime.fromisoformat(source_spot["timeStamp"].replace("Z", "+00:00")).timestamp())
# Add to our list. Don't worry about de-duping, removing old spots etc. at this point; other code will do
+2 -1
View File
@@ -31,7 +31,8 @@ class Tiles(HTTPSpotProvider):
# Tiles spots can include POTA & SOTA references, but ignore those on the basis that we will get them separately from the POTA/SOTA providers anyway.
# Just take the grid reference itself as the single Tiles SIG reference.
sig_refs=[SIGRef(id=source_spot["maidenhead_grid"], sig="Tiles",
name=source_spot["maidenhead_grid"])],
name=source_spot["maidenhead_grid"], latitude=source_spot["latitude"],
longitude=source_spot["longitude"])],
time=datetime.fromisoformat(source_spot["created_at"].replace("Z", "+00:00")).timestamp(),
dx_grid=source_spot["maidenhead_grid"],
dx_latitude=source_spot["latitude"],
+2 -1
View File
@@ -20,7 +20,8 @@ class WWBOTA(SSESpotProvider):
# n-fer activations.
refs = []
for ref in source_spot["references"]:
sigref = SIGRef(id=ref["reference"], sig="WWBOTA", name=ref["name"])
sigref = SIGRef(id=ref["reference"], sig="WWBOTA", name=ref["name"], latitude=ref["lat"],
longitude=ref["long"])
refs.append(sigref)
spot = Spot(source=self.name,
+2 -1
View File
@@ -29,7 +29,8 @@ class WWFF(HTTPSpotProvider):
mode=source_spot["mode"].upper(),
comment=source_spot["remarks"],
sig="WWFF",
sig_refs=[SIGRef(id=source_spot["reference"], sig="WWFF", name=source_spot["reference_name"])],
sig_refs=[SIGRef(id=source_spot["reference"], sig="WWFF", name=source_spot["reference_name"],
latitude=source_spot["latitude"], longitude=source_spot["longitude"])],
time=datetime.fromtimestamp(source_spot["spot_time"], tz=pytz.UTC).timestamp(),
dx_latitude=source_spot["latitude"],
dx_longitude=source_spot["longitude"])