|
|
|
@ -427,20 +427,32 @@ export const WorldMap = ({
|
|
|
|
pskMarkersRef.current.forEach(m => map.removeLayer(m));
|
|
|
|
pskMarkersRef.current.forEach(m => map.removeLayer(m));
|
|
|
|
pskMarkersRef.current = [];
|
|
|
|
pskMarkersRef.current = [];
|
|
|
|
|
|
|
|
|
|
|
|
if (showPSKReporter && pskReporterSpots && pskReporterSpots.length > 0 && deLocation) {
|
|
|
|
// Validate deLocation exists and has valid coordinates
|
|
|
|
|
|
|
|
const hasValidDE = deLocation &&
|
|
|
|
|
|
|
|
typeof deLocation.lat === 'number' && !isNaN(deLocation.lat) &&
|
|
|
|
|
|
|
|
typeof deLocation.lon === 'number' && !isNaN(deLocation.lon);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (showPSKReporter && pskReporterSpots && pskReporterSpots.length > 0 && hasValidDE) {
|
|
|
|
pskReporterSpots.forEach(spot => {
|
|
|
|
pskReporterSpots.forEach(spot => {
|
|
|
|
if (spot.lat && spot.lon) {
|
|
|
|
// Validate spot coordinates are valid numbers
|
|
|
|
|
|
|
|
const spotLat = parseFloat(spot.lat);
|
|
|
|
|
|
|
|
const spotLon = parseFloat(spot.lon);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!isNaN(spotLat) && !isNaN(spotLon)) {
|
|
|
|
const displayCall = spot.receiver || spot.sender;
|
|
|
|
const displayCall = spot.receiver || spot.sender;
|
|
|
|
const freqMHz = spot.freqMHz || (spot.freq ? (spot.freq / 1000000).toFixed(3) : '?');
|
|
|
|
const freqMHz = spot.freqMHz || (spot.freq ? (spot.freq / 1000000).toFixed(3) : '?');
|
|
|
|
const bandColor = getBandColor(parseFloat(freqMHz));
|
|
|
|
const bandColor = getBandColor(parseFloat(freqMHz));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
// Draw line from DE to spot location
|
|
|
|
// Draw line from DE to spot location
|
|
|
|
const points = getGreatCirclePoints(
|
|
|
|
const points = getGreatCirclePoints(
|
|
|
|
[deLocation.lat, deLocation.lon],
|
|
|
|
deLocation.lat, deLocation.lon,
|
|
|
|
[spot.lat, spot.lon],
|
|
|
|
spotLat, spotLon,
|
|
|
|
50
|
|
|
|
50
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Validate points before creating polyline
|
|
|
|
|
|
|
|
if (points && points.length > 1 && points.every(p => Array.isArray(p) && !isNaN(p[0]) && !isNaN(p[1]))) {
|
|
|
|
const line = L.polyline(points, {
|
|
|
|
const line = L.polyline(points, {
|
|
|
|
color: bandColor,
|
|
|
|
color: bandColor,
|
|
|
|
weight: 1.5,
|
|
|
|
weight: 1.5,
|
|
|
|
@ -448,9 +460,10 @@ export const WorldMap = ({
|
|
|
|
dashArray: '4, 4'
|
|
|
|
dashArray: '4, 4'
|
|
|
|
}).addTo(map);
|
|
|
|
}).addTo(map);
|
|
|
|
pskMarkersRef.current.push(line);
|
|
|
|
pskMarkersRef.current.push(line);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Add small dot marker at spot location
|
|
|
|
// Add small dot marker at spot location
|
|
|
|
const circle = L.circleMarker([spot.lat, spot.lon], {
|
|
|
|
const circle = L.circleMarker([spotLat, spotLon], {
|
|
|
|
radius: 4,
|
|
|
|
radius: 4,
|
|
|
|
fillColor: bandColor,
|
|
|
|
fillColor: bandColor,
|
|
|
|
color: '#fff',
|
|
|
|
color: '#fff',
|
|
|
|
@ -463,6 +476,9 @@ export const WorldMap = ({
|
|
|
|
${spot.snr !== null ? `SNR: ${spot.snr > 0 ? '+' : ''}${spot.snr} dB` : ''}
|
|
|
|
${spot.snr !== null ? `SNR: ${spot.snr > 0 ? '+' : ''}${spot.snr} dB` : ''}
|
|
|
|
`).addTo(map);
|
|
|
|
`).addTo(map);
|
|
|
|
pskMarkersRef.current.push(circle);
|
|
|
|
pskMarkersRef.current.push(circle);
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
|
|
console.warn('Error rendering PSKReporter spot:', err);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|