mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-12-15 16:43:38 +00:00
Reject "AA00aa" grids and 0/0 latlons from online lookup
This commit is contained in:
@@ -315,23 +315,25 @@ class LookupHelper:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
# Infer a latitude and longitude from a callsign (requires QRZ.com/HamQTH)
|
# Infer a latitude and longitude from a callsign (requires QRZ.com/HamQTH)
|
||||||
|
# Coordinates that look default are rejected (apologies if your position really is 0,0, enjoy your voyage)
|
||||||
def infer_latlon_from_callsign_online_lookup(self, call):
|
def infer_latlon_from_callsign_online_lookup(self, call):
|
||||||
data = self.get_qrz_data_for_callsign(call)
|
data = self.get_qrz_data_for_callsign(call)
|
||||||
if data and "latitude" in data and "longitude" in data:
|
if data and "latitude" in data and "longitude" in data and (data["latitude"] != 0 or data["longitude"] != 0):
|
||||||
return [data["latitude"], data["longitude"]]
|
return [data["latitude"], data["longitude"]]
|
||||||
data = self.get_hamqth_data_for_callsign(call)
|
data = self.get_hamqth_data_for_callsign(call)
|
||||||
if data and "latitude" in data and "longitude" in data:
|
if data and "latitude" in data and "longitude" in data and (data["latitude"] != 0 or data["longitude"] != 0):
|
||||||
return [data["latitude"], data["longitude"]]
|
return [data["latitude"], data["longitude"]]
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Infer a grid locator from a callsign (requires QRZ.com/HamQTH)
|
# Infer a grid locator from a callsign (requires QRZ.com/HamQTH).
|
||||||
|
# Grids that look default are rejected (apologies if your grid really is AA00aa, enjoy your research)
|
||||||
def infer_grid_from_callsign_online_lookup(self, call):
|
def infer_grid_from_callsign_online_lookup(self, call):
|
||||||
data = self.get_qrz_data_for_callsign(call)
|
data = self.get_qrz_data_for_callsign(call)
|
||||||
if data and "locator" in data:
|
if data and "locator" in data and data["locator"].upper() != "AA00" and data["locator"].upper() != "AA00AA" and data["locator"].upper() != "AA00AA00":
|
||||||
return data["locator"]
|
return data["locator"]
|
||||||
data = self.get_hamqth_data_for_callsign(call)
|
data = self.get_hamqth_data_for_callsign(call)
|
||||||
if data and "grid" in data:
|
if data and "grid" in data and data["grid"].upper() != "AA00" and data["grid"].upper() != "AA00AA" and data["grid"].upper() != "AA00AA00":
|
||||||
return data["grid"]
|
return data["grid"]
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|||||||
Reference in New Issue
Block a user