mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 16:59:25 +00:00
Geodesics #42
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
// Map layers
|
// Map layers
|
||||||
var markersLayer;
|
var markersLayer;
|
||||||
|
var geodesicsLayer;
|
||||||
var terminator;
|
var terminator;
|
||||||
|
|
||||||
// Load spots and populate the table.
|
// Load spots and populate the table.
|
||||||
@@ -29,16 +30,29 @@ function buildQueryString() {
|
|||||||
function updateMap() {
|
function updateMap() {
|
||||||
// Clear existing content
|
// Clear existing content
|
||||||
markersLayer.clearLayers();
|
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.
|
// Make new markers for all spots with a good location, not QRT, and not a duplicate spot within the data set.
|
||||||
var callsAlreadyDisplayed = [];
|
var callsAlreadyDisplayed = [];
|
||||||
spots.forEach(function (s) {
|
spots.forEach(function (s) {
|
||||||
if (s["dx_location_good"] && (s["qrt"] == null || s["qrt"] == false)) {
|
if (s["dx_location_good"] && (s["qrt"] == null || s["qrt"] == false)) {
|
||||||
if (!callsAlreadyDisplayed.includes(s["dx_call"])) {
|
if (!callsAlreadyDisplayed.includes(s["dx_call"])) {
|
||||||
|
|
||||||
// OK, create the marker
|
// 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));
|
m.bindPopup(getTooltipText(s));
|
||||||
markersLayer.addLayer(m);
|
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"]);
|
callsAlreadyDisplayed.push(s["dx_call"]);
|
||||||
}
|
}
|
||||||
@@ -198,6 +212,10 @@ function setUpMap() {
|
|||||||
markersLayer = new L.LayerGroup();
|
markersLayer = new L.LayerGroup();
|
||||||
markersLayer.addTo(map);
|
markersLayer.addTo(map);
|
||||||
|
|
||||||
|
// Add geodesic layer
|
||||||
|
geodesicsLayer = new L.LayerGroup();
|
||||||
|
geodesicsLayer.addTo(map);
|
||||||
|
|
||||||
// Add terminator/greyline
|
// Add terminator/greyline
|
||||||
terminator = L.terminator({
|
terminator = L.terminator({
|
||||||
interactive: false
|
interactive: false
|
||||||
|
|||||||
Reference in New Issue
Block a user