mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
Start work on bands display. #48
This commit is contained in:
@@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user