Start work on bands display. #48

This commit is contained in:
Ian Renton
2025-10-20 18:44:51 +01:00
parent 53977c5306
commit 6ca9f28a56
7 changed files with 365 additions and 23 deletions

View File

@@ -3,7 +3,7 @@ var markersLayer;
var geodesicsLayer;
var terminator;
// Load spots and populate the table.
// Load spots and populate the map.
function loadSpots() {
$.getJSON('/api/v1/spots' + buildQueryString(), function(jsonData) {
// Store data
@@ -23,6 +23,8 @@ function buildQueryString() {
}
});
str = str + "max_age=" + $("#max-spot-age option:selected").val();
// Additional filters for the map view: No dupes, no QRT, only spots with locations
str = str + "&dedupe=true&allow_qrt=false&needs_location=true";
return str;
}
@@ -32,29 +34,20 @@ function updateMap() {
markersLayer.clearLayers();
geodesicsLayer.clearLayers();
// Make new markers for all spots with a good location, not QRT, and not a duplicate spot within the data set.
var callsAlreadyDisplayed = [];
// Make new markers for all spots that match the filter
spots.forEach(function (s) {
if (s["dx_location_good"] && (s["qrt"] == null || s["qrt"] == false)) {
if (!callsAlreadyDisplayed.includes(s["dx_call"])) {
var m = L.marker([s["dx_latitude"], s["dx_longitude"]], {icon: getIcon(s)});
m.bindPopup(getTooltipText(s));
markersLayer.addLayer(m);
// OK, create the marker
var m = L.marker([s["dx_latitude"], s["dx_longitude"]], {icon: getIcon(s)});
m.bindPopup(getTooltipText(s));
markersLayer.addLayer(m);
// Create geodesics if required
if ($("#mapShowGeodesics")[0].checked && s["de_latitude"] != null && s["de_longitude"] != null) {
var geodesic = L.geodesic([[s["de_latitude"], s["de_longitude"]], m.getLatLng()], {
color: s["band_color"],
wrap: false,
steps: 5
});
geodesicsLayer.addLayer(geodesic);
}
}
callsAlreadyDisplayed.push(s["dx_call"]);
// Create geodesics if required
if ($("#mapShowGeodesics")[0].checked && s["de_latitude"] != null && s["de_longitude"] != null) {
var geodesic = L.geodesic([[s["de_latitude"], s["de_longitude"]], m.getLatLng()], {
color: s["band_color"],
wrap: false,
steps: 5
});
geodesicsLayer.addLayer(geodesic);
}
});
}