From 3a066ea5894c915a4c3dc74a9cda5266870a4d20 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 3 May 2026 06:39:58 +0000 Subject: [PATCH] Rttningar --- collector/main.py | 19 +++++++++++++++++++ web/index.html | 26 +++++++++++++------------- web/nginx.conf | 1 + 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/collector/main.py b/collector/main.py index 1228eb8..ccc8a45 100644 --- a/collector/main.py +++ b/collector/main.py @@ -28,6 +28,21 @@ from maidenhead import latlon_to_subsquare, subsquare_bounds import re as _re +def _valid_position(lat, lon) -> bool: + """Filter out corrupt or irrelevant positions.""" + if lat is None or lon is None: + return False + if lat != lat or lon != lon: # NaN check + return False + if abs(lat) < 0.01 and abs(lon) < 0.01: # 0,0 = no GPS fix + return False + if lat < 54 or lat > 72: # outside Scandinavia + return False + if lon < 4 or lon > 32: # outside Scandinavia + return False + return True + + def _extract_digis(path: str) -> str: """ Reduce a raw APRS path to the actual physical digipeaters that handled it. @@ -187,6 +202,10 @@ async def ingest_rf(frame: RFFrameIn) -> None: lat, lon, _ = _parse_position(tnc2) + # Nullify invalid positions so they are stored as NULL rather than corrupt data + if not _valid_position(lat, lon): + lat, lon = None, None + logger.info( "RF %-6s %-9s [%s] lat=%s lon=%s", "DIRECT" if frame.heard_direct else "VIA", diff --git a/web/index.html b/web/index.html index a964cd1..29d002c 100644 --- a/web/index.html +++ b/web/index.html @@ -3,7 +3,7 @@ -heardlog ??? APRS RF Coverage +heardlog – APRS RF Coverage