diff --git a/templates/index.html b/templates/index.html index b5a32a8..b3cf7ad 100644 --- a/templates/index.html +++ b/templates/index.html @@ -8363,8 +8363,22 @@ if (!pass || !pass.groundTrack) return; // Remove old track and marker - if (groundTrackLine) groundTrackMap.removeLayer(groundTrackLine); - if (satMarker) groundTrackMap.removeLayer(satMarker); + if (groundTrackLine) { + groundTrackMap.removeLayer(groundTrackLine); + groundTrackLine = null; + } + if (satMarker) { + groundTrackMap.removeLayer(satMarker); + satMarker = null; + } + if (orbitTrackLine) { + groundTrackMap.removeLayer(orbitTrackLine); + orbitTrackLine = null; + } + if (pastOrbitLine) { + groundTrackMap.removeLayer(pastOrbitLine); + pastOrbitLine = null; + } // Split ground track at antimeridian crossings const segments = []; diff --git a/templates/satellite_dashboard.html b/templates/satellite_dashboard.html index c516409..8c673a4 100644 --- a/templates/satellite_dashboard.html +++ b/templates/satellite_dashboard.html @@ -1161,10 +1161,19 @@ function updateGroundTrack(pass) { if (!groundMap) return; - // Clear all existing map layers - if (trackLine) groundMap.removeLayer(trackLine); - if (satMarker) groundMap.removeLayer(satMarker); - if (orbitTrack) groundMap.removeLayer(orbitTrack); + // Clear all existing map layers and reset references + if (trackLine) { + groundMap.removeLayer(trackLine); + trackLine = null; + } + if (satMarker) { + groundMap.removeLayer(satMarker); + satMarker = null; + } + if (orbitTrack) { + groundMap.removeLayer(orbitTrack); + orbitTrack = null; + } if (pass && pass.groundTrack) { // Split track at antimeridian crossings to avoid lines across map