mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-08-14 16:37:33 +00:00
Add types and altitudes to SIG Ref lookups
This commit is contained in:
@@ -21,6 +21,7 @@ class ARLHS(FileDownloadSIGRefDataProvider):
|
||||
if "ARLHS" in row and row["ARLHS"] != "":
|
||||
ref_id = row["ARLHS"]
|
||||
new_data.append(SIGRef(sig=self.SIG, id=ref_id, name=row["Name"] if "Name" in row else None,
|
||||
type="Lighthouse",
|
||||
url="https://www.cqgma.org/zinfo.php?ref=" + ref_id,
|
||||
latitude=float(row["Latitude"]) if "Latitude" in row and row[
|
||||
"Latitude"] != "" else None,
|
||||
|
||||
@@ -27,6 +27,7 @@ class DME(LocalFileSIGRefDataProvider):
|
||||
"LONGITUD_ETRS89_REGCAN95") else None
|
||||
|
||||
ref = SIGRef(sig=self.SIG, id=ref_id,
|
||||
type="Town",
|
||||
name=row["NOMBRE_ACTUAL"] + ", " + row["PROVINCIA"],
|
||||
latitude=latitude,
|
||||
longitude=longitude)
|
||||
|
||||
@@ -20,11 +20,14 @@ class GMA(FileDownloadSIGRefDataProvider):
|
||||
for row in csv.DictReader(http_response.content.decode("utf-8-sig").splitlines()[1:]):
|
||||
ref_id = row["Reference"]
|
||||
new_data.append(SIGRef(sig=self.SIG, id=ref_id, name=row["Name"] if "Name" in row else None,
|
||||
type="Summit",
|
||||
url="https://www.cqgma.org/zinfo.php?ref=" + ref_id,
|
||||
latitude=float(row["Latitude"]) if "Latitude" in row and row[
|
||||
"Latitude"] != "" else None,
|
||||
longitude=float(row["Longitude"]) if "Longitude" in row and row[
|
||||
"Longitude"] != "" else None,
|
||||
altitude=float(row["Height (m)"].replace("m", "")) if "Height (m)" in row and row[
|
||||
"Height (m)"] != "" else None,
|
||||
grid=row["Maidenhead Locator"]))
|
||||
|
||||
# Bail out if a stop has been requested, i.e. the program is shutting down - no need to parse the rest of
|
||||
|
||||
@@ -21,6 +21,7 @@ class ILLW(FileDownloadSIGRefDataProvider):
|
||||
if "ILLW" in row and row["ILLW"] != "":
|
||||
ref_id = row["ILLW"]
|
||||
new_data.append(SIGRef(sig=self.SIG, id=ref_id, name=row["Name"] if "Name" in row else None,
|
||||
type="Lighthouse",
|
||||
url="https://www.cqgma.org/zinfo.php?ref=" + ref_id,
|
||||
latitude=float(row["Latitude"]) if "Latitude" in row and row[
|
||||
"Latitude"] != "" else None,
|
||||
|
||||
@@ -32,7 +32,7 @@ class IOTA(FileDownloadSIGRefDataProvider):
|
||||
logging.debug(f"Error converting lat/lon to locator for an IOTA reference %f %f", latitude, longitude)
|
||||
|
||||
new_data.append(SIGRef(sig=self.SIG, id=ref_id, name=ref["name"],
|
||||
grid=grid, latitude=latitude, longitude=longitude))
|
||||
type="Island", grid=grid, latitude=latitude, longitude=longitude))
|
||||
|
||||
# Bail out if a stop has been requested, i.e. the program is shutting down - no need to parse the rest
|
||||
# of the data in this case
|
||||
|
||||
@@ -26,6 +26,7 @@ class LLOTA(FileDownloadSIGRefDataProvider):
|
||||
ll = locator_to_latlong(grid)
|
||||
|
||||
new_data.append(SIGRef(sig=self.SIG, id=ref_id, name=str(ref["name"]),
|
||||
type="Lake",
|
||||
url="https://llota.app/list/ref/" + ref_id,
|
||||
grid=grid,
|
||||
latitude=ll[0],
|
||||
|
||||
@@ -20,6 +20,7 @@ class MOTA(FileDownloadSIGRefDataProvider):
|
||||
for row in csv.DictReader(http_response.content.decode("utf-8-sig").splitlines()[1:]):
|
||||
ref_id = row["Reference"]
|
||||
new_data.append(SIGRef(sig=self.SIG, id=ref_id, name=row["Name"] if "Name" in row else None,
|
||||
type="Mill",
|
||||
url="https://www.cqgma.org/zinfo.php?ref=" + ref_id,
|
||||
latitude=float(row["Latitude"]) if "Latitude" in row and row[
|
||||
"Latitude"] != "" else None,
|
||||
|
||||
@@ -36,6 +36,7 @@ class ParksNPeaksKMLSIGRefDataProvider(FileDownloadSIGRefDataProvider):
|
||||
longitude, latitude = placemark.geometry.x, placemark.geometry.y
|
||||
|
||||
ref = SIGRef(sig=self.sig_name, id=ref_id, name=placemark.name,
|
||||
type="Park",
|
||||
url="https://parksnpeaks.org/getPark.php?actPark=" + ref_id,
|
||||
latitude=latitude,
|
||||
longitude=longitude)
|
||||
|
||||
@@ -20,6 +20,7 @@ class POTA(FileDownloadSIGRefDataProvider):
|
||||
for row in csv.DictReader(http_response.content.decode("utf-8-sig").splitlines()):
|
||||
ref_id = row["reference"]
|
||||
new_data.append(SIGRef(sig=self.SIG, id=ref_id, name=row["name"] if "name" in row else None,
|
||||
type="Park",
|
||||
url="https://pota.app/#/park/" + ref_id,
|
||||
grid=row["grid"] if "grid" in row else None,
|
||||
latitude=float(row["latitude"]) if "latitude" in row and row[
|
||||
|
||||
@@ -20,6 +20,7 @@ class SIOTA(FileDownloadSIGRefDataProvider):
|
||||
for row in csv.DictReader(http_response.content.decode("utf-8-sig").splitlines()):
|
||||
ref_id = row["SILO_CODE"]
|
||||
new_data.append(SIGRef(sig=self.SIG, id=ref_id, name=row["NAME"] if "NAME" in row else None,
|
||||
type="Silo",
|
||||
grid=row["LOCATOR"] if "LOCATOR" in row else None,
|
||||
latitude=float(row["LAT"]) if "LAT" in row else None,
|
||||
longitude=float(row["LNG"]) if "LNG" in row else None))
|
||||
|
||||
@@ -23,10 +23,13 @@ class SOTA(FileDownloadSIGRefDataProvider):
|
||||
ref_id = row["SummitCode"]
|
||||
latitude = float(row["Latitude"]) if "Latitude" in row and row["Latitude"] != "" else None
|
||||
longitude = float(row["Longitude"]) if "Longitude" in row and row["Longitude"] != "" else None
|
||||
altitude = float(row["AltM"]) if "AltM" in row and row["AltM"] != "" else None
|
||||
ref = SIGRef(sig=self.SIG, id=ref_id, name=row["SummitName"] if "SummitName" in row else None,
|
||||
type="Summit",
|
||||
url="https://www.sotadata.org.uk/en/summit/" + ref_id,
|
||||
latitude=latitude,
|
||||
longitude=longitude,
|
||||
altitude=altitude,
|
||||
activation_score=int(row["Points"]) if "Points" in row else None)
|
||||
if latitude and longitude:
|
||||
ref.grid = latlong_to_locator(latitude, longitude, 6)
|
||||
|
||||
@@ -19,8 +19,8 @@ class Toilets(LocalFileSIGRefDataProvider):
|
||||
csv_data = _f.read()
|
||||
dr = csv.DictReader(csv_data.splitlines())
|
||||
for row in dr:
|
||||
new_data.append(SIGRef(sig=self.SIG, id=row["ref"], name=row["ref"], latitude=float(row["lat"]),
|
||||
longitude=float(row["lon"])))
|
||||
new_data.append(SIGRef(sig=self.SIG, id=row["ref"], name=row["ref"], type="Toilet",
|
||||
latitude=float(row["lat"]), longitude=float(row["lon"])))
|
||||
|
||||
# Bail out if a stop has been requested, i.e. the program is shutting down - no need to parse the rest
|
||||
# of the data in this case
|
||||
|
||||
@@ -20,6 +20,7 @@ class Towers(FileDownloadSIGRefDataProvider):
|
||||
for row in csv.DictReader(http_response.content.decode("utf-8-sig").splitlines(), delimiter=";"):
|
||||
ref_id = row["Ref"]
|
||||
new_data.append(SIGRef(sig=self.SIG, id=ref_id, name=row["Nazev"] if "Nazev" in row else None,
|
||||
type="Tower",
|
||||
url="https://wwtota.com/seznam/karta_rozhledny.php?ref=" + ref_id,
|
||||
grid=row["Lokator"] if "Lokator" in row and row["Lokator"] != "" else None,
|
||||
latitude=float(row["Lat"]) if "Lat" in row and row["Lat"] != "" else None,
|
||||
|
||||
@@ -37,6 +37,7 @@ class WCA(FileDownloadSIGRefDataProvider):
|
||||
logging.debug(f"Encountered dodgy formatting in WCA CSV, skipping location data for %s", ref_id)
|
||||
|
||||
new_data.append(SIGRef(sig=self.SIG, id=ref_id, name=row["CLEAN NAME"] if "CLEAN NAME" in row else None,
|
||||
type="Castle",
|
||||
url="https://www.cqgma.org/zinfo.php?ref=" + ref_id,
|
||||
latitude=latitude,
|
||||
longitude=longitude,
|
||||
|
||||
@@ -26,9 +26,11 @@ class WOTA(FileDownloadSIGRefDataProvider):
|
||||
url = "https://www.wota.org.uk/MM_LDO-" + str(number + 214)
|
||||
|
||||
new_data.append(SIGRef(sig=self.SIG, id=ref_id, name=feature["properties"]["title"], url=url,
|
||||
type="Summit",
|
||||
grid=feature["properties"]["qthLocator"],
|
||||
latitude=feature["geometry"]["coordinates"][1],
|
||||
longitude=feature["geometry"]["coordinates"][0]))
|
||||
longitude=feature["geometry"]["coordinates"][0],
|
||||
altitude=feature["properties"]["height"]))
|
||||
|
||||
# Bail out if a stop has been requested, i.e. the program is shutting down - no need to parse the rest of
|
||||
# the data in this case
|
||||
|
||||
@@ -20,6 +20,7 @@ class WWBOTA(FileDownloadSIGRefDataProvider):
|
||||
for row in csv.DictReader(http_response.content.decode("utf-8-sig").splitlines()):
|
||||
ref_id = row["Reference"]
|
||||
new_data.append(SIGRef(sig=self.SIG, id=ref_id, name=row["Name"] if "Name" in row else None,
|
||||
type="Bunker",
|
||||
url="https://bunkerwiki.org/?s=" + ref_id if ref_id.startswith("B/G") else None,
|
||||
grid=row["Locator"] if "Locator" in row and row["Locator"] != "" else None,
|
||||
latitude=float(row["Lat"]) if "Lat" in row and row["Lat"] != "" else None,
|
||||
|
||||
@@ -20,6 +20,7 @@ class WWFF(FileDownloadSIGRefDataProvider):
|
||||
for row in csv.DictReader(http_response.content.decode("utf-8-sig").splitlines()):
|
||||
ref_id = row["reference"]
|
||||
new_data.append(SIGRef(sig=self.SIG, id=ref_id, name=row["name"] if "name" in row else None,
|
||||
type="Park",
|
||||
url="https://wwff.co/directory/?showRef=" + ref_id,
|
||||
grid=row["iaruLocator"] if "iaruLocator" in row and row[
|
||||
"iaruLocator"] != "-" else None,
|
||||
|
||||
@@ -26,11 +26,20 @@ class ZLOTA(FileDownloadSIGRefDataProvider):
|
||||
longitude = ref["longitude"]
|
||||
|
||||
new_ref = SIGRef(sig=self.SIG, id=ref_id, name=ref["name"],
|
||||
type=ref["asset_type"].title,
|
||||
url="https://ontheair.nz/assets/" + ref_id.replace("/", "_"),
|
||||
latitude=latitude,
|
||||
longitude=longitude)
|
||||
|
||||
# Check lat/lon validity and update grid accordingly
|
||||
if latitude and longitude:
|
||||
ref.new_ref = latlong_to_locator(latitude, longitude, 6)
|
||||
try:
|
||||
new_ref.grid = latlong_to_locator(latitude, longitude, 6)
|
||||
except ValueError:
|
||||
# Junk lat/lon, remove from the spot
|
||||
new_ref.latitude = None
|
||||
new_ref.longitude = None
|
||||
|
||||
new_data.append(new_ref)
|
||||
|
||||
# Bail out if a stop has been requested, i.e. the program is shutting down - no need to parse the rest
|
||||
|
||||
Reference in New Issue
Block a user