From b4206b63d15cc3dde7fd62a4e27160a97ac55424 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Mon, 21 Jul 2025 11:23:37 -0500 Subject: [PATCH] Increase GPS drift threshold from 15m to 50m MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed issue where stationary stations like K5SGD-D were showing multiple positions due to minor GPS accuracy variations. The previous 15-meter threshold was too strict for typical GPS drift which can vary 5-30 meters. - Increased default threshold in GeoUtils from 10m to 50m - Updated packet processor to use 50m threshold for movement detection - Verified with K5SGD-D showing ~24m variations that are now ignored 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- lib/aprsme/geo_utils.ex | 4 ++-- lib/aprsme_web/live/map_live/packet_processor.ex | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/aprsme/geo_utils.ex b/lib/aprsme/geo_utils.ex index 8fec9eb..a396e64 100644 --- a/lib/aprsme/geo_utils.ex +++ b/lib/aprsme/geo_utils.ex @@ -39,9 +39,9 @@ defmodule Aprsme.GeoUtils do Check if the distance between two points exceeds a minimum threshold. This helps filter out GPS drift and insignificant movements. - Default threshold is 10 meters to account for typical GPS accuracy. + Default threshold is 50 meters to account for typical GPS accuracy variations. """ - def significant_movement?(lat1, lon1, lat2, lon2, threshold_meters \\ 10) do + def significant_movement?(lat1, lon1, lat2, lon2, threshold_meters \\ 50) do case haversine_distance(lat1, lon1, lat2, lon2) do nil -> false distance -> distance > threshold_meters diff --git a/lib/aprsme_web/live/map_live/packet_processor.ex b/lib/aprsme_web/live/map_live/packet_processor.ex index 991bce1..8441add 100644 --- a/lib/aprsme_web/live/map_live/packet_processor.ex +++ b/lib/aprsme_web/live/map_live/packet_processor.ex @@ -60,11 +60,11 @@ defmodule AprsmeWeb.MapLive.PacketProcessor do # Check if we have valid existing coordinates if is_number(existing_lat) and is_number(existing_lon) and - GeoUtils.significant_movement?(existing_lat, existing_lon, lat, lon, 15) do - # Significant movement detected (more than 15 meters), update the marker + GeoUtils.significant_movement?(existing_lat, existing_lon, lat, lon, 50) do + # Significant movement detected (more than 50 meters), update the marker handle_valid_postgres_packet(packet, lat, lon, socket) else - # Just GPS drift or invalid coordinates, update the packet data but don't send visual update + # Just GPS drift (less than 50 meters) or invalid coordinates, update the packet data but don't send visual update new_visible_packets = Map.put(socket.assigns.visible_packets, callsign_key, packet) assign(socket, :visible_packets, new_visible_packets) end