mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
Geodesics #42
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// Map layers
|
||||
var markersLayer;
|
||||
var geodesicsLayer;
|
||||
var terminator;
|
||||
|
||||
// Load spots and populate the table.
|
||||
@@ -29,16 +30,29 @@ function buildQueryString() {
|
||||
function updateMap() {
|
||||
// Clear existing content
|
||||
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 = [];
|
||||
spots.forEach(function (s) {
|
||||
if (s["dx_location_good"] && (s["qrt"] == null || s["qrt"] == false)) {
|
||||
if (!callsAlreadyDisplayed.includes(s["dx_call"])) {
|
||||
|
||||
// OK, create the marker
|
||||
let m = L.marker([s["dx_latitude"], s["dx_longitude"]], {icon: getIcon(s)});
|
||||
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"]);
|
||||
}
|
||||
@@ -198,6 +212,10 @@ function setUpMap() {
|
||||
markersLayer = new L.LayerGroup();
|
||||
markersLayer.addTo(map);
|
||||
|
||||
// Add geodesic layer
|
||||
geodesicsLayer = new L.LayerGroup();
|
||||
geodesicsLayer.addTo(map);
|
||||
|
||||
// Add terminator/greyline
|
||||
terminator = L.terminator({
|
||||
interactive: false
|
||||
|
||||
Reference in New Issue
Block a user