diff --git a/css/main.css b/css/main.css
index 5c6977c..f082ec2 100644
--- a/css/main.css
+++ b/css/main.css
@@ -767,6 +767,19 @@ header .search form input[type='submit'] {
filter: drop-shadow(1px 0px 0 white) drop-shadow(0px 1px 0 white) drop-shadow(-1px -0px 0 white) drop-shadow(-0px -1px 0 white);
}
+.leaflet-marker-icon .number{
+ position: relative;
+ top: -41px;
+ font-size: 12px;
+ width: 25px;
+ text-align: center;
+}
+
+.leaflet-div-icon {
+ background: transparent !important;
+ border: none !important;
+}
+
@media only screen and (min-width: 900px) {
}
diff --git a/img/markers/marker_hole.png b/img/markers/marker_hole.png
new file mode 100644
index 0000000..17481f2
Binary files /dev/null and b/img/markers/marker_hole.png differ
diff --git a/js/tracker.js b/js/tracker.js
index 8d81bba..4960c2c 100644
--- a/js/tracker.js
+++ b/js/tracker.js
@@ -28,10 +28,20 @@ var receivers = [];
var recovery_names = [];
var recoveries = [];
+var launchPredictions = {};
+
var launches = null;
var receiverCanvas = null;
var sondePrefix = ["RS92", "RS92-SGP", "RS92-NGP", "RS41", "RS41-SG", "RS41-SGP", "RS41-SGM", "DFM", "DFM06", "DFM09", "DFM17", "M10", "M20", "iMet-4", "iMet-54", "LMS6", "LMS6-400", "LMS6-1680", "iMS-100", "MRZ", "chase"];
+var sondeCodes = {
+ "07":"iMet-1", "11":"LMS6-403", "13":"RS92", "14":"RS92", "17":"DFM-09", "18":"DFM-06", "19":"MRZ-N1", "22":"RS-11G", "23":"RS41", "24":"RS41", "34":"iMet-4", "35":"iMS-100", "41":"RS41", "42":"RS41", "52":"RS92-NGP",
+ "54":"DFM-17", "62":"MRZ-3MK", "63":"M20", "77":"M10", "82":"LMS6-1680", "84":"iMet-54"
+};
+var unsupportedSondeCodes = {
+ "15":"PAZA-12M", "16":"PAZA-22", "20":"MK3", "21":"1524LA LORAN-C/GL5000", "26":"SRS-C34", "27":"AVK-MRZ", "28":"AVK–AK2-02", "29":"MARZ2-2", "30":"RS2-80", "33":"GTS1-2/GFE(L)", "45":"CF-06", "58":"AVK-BAR",
+ "59":"M2K2-R", "68":"AVK-RZM-2", "69":"MARL-A/Vektor-M-RZM-2", "73":"MARL-A", "78":"RS90", "80":"RS92", "88":"MARL-A/Vektor-M-MRZ", "89":"MARL-A/Vektor-M-BAR", "97":"iMet-2", "99":"iMet-2"
+};
var got_positions = false;
var zoomed_in = false;
@@ -563,6 +573,34 @@ function load() {
liveData();
};
+ L.NumberedDivIcon = L.Icon.extend({
+ options: {
+ iconUrl: host_url + markers_url + "marker_hole.png",
+ number: '',
+ shadowUrl: null,
+ iconSize: new L.Point(25, 41),
+ iconAnchor: new L.Point(13, 41),
+ popupAnchor: new L.Point(0, -33),
+ className: 'leaflet-div-icon'
+ },
+
+ createIcon: function () {
+ var div = document.createElement('div');
+ var img = this._createImg(this.options['iconUrl']);
+ var numdiv = document.createElement('div');
+ numdiv.setAttribute ( "class", "number" );
+ numdiv.innerHTML = this.options['number'] || '';
+ div.appendChild ( img );
+ div.appendChild ( numdiv );
+ this._setIconStyles(div, 'icon');
+ return div;
+ },
+
+ createShadow: function () {
+ return null;
+ }
+ });
+
map.whenReady(callBack);
// animate-in the timebox,
@@ -609,6 +647,186 @@ function setTimeValue() {
}, 100);
}
+function launchSitePredictions(times, station, properties, marker) {
+ var popup = launches.getLayer(marker).getPopup();
+ var popupContent = popup.getContent();
+ var popupContentSplit = popupContent.split("";
+ popup.setContent(popupContentSplit);
+ if (popupContent.includes("Delete")) {
+ deletePredictions(marker);
+ popupContent = popupContent.split("";
+ popup.setContent(popupContent);
+ }
+ }
+ function handleError(error) {
+ completed += 1;
+ if (completed == dates.length) {
+ popupContent += "";
+ popup.setContent(popupContent);
+ }
+ }
+}
+
+function plotPrediction (data, dates, marker, properties) {
+ if (!launchPredictions.hasOwnProperty(marker)) {
+ launchPredictions[marker] = {};
+ }
+ launchPredictions[marker][dates.indexOf(data.request.launch_datetime)+1] = {};
+ plot = launchPredictions[marker][dates.indexOf(data.request.launch_datetime)+1];
+
+ ascent = data.prediction[0].trajectory;
+ descent = data.prediction[1].trajectory;
+ var predictionPath = [];
+ for (var i = 0; i < ascent.length; i++) {
+ if (ascent[i].longitude > 180.0) {
+ var longitude = ascent[i].longitude - 360.0;
+ } else {
+ var longitude = ascent[i].longitude;
+ }
+ predictionPath.push([ascent[i].latitude, longitude]);
+ };
+ for (var x = 0; x < descent.length; x++) {
+ if (descent[x].longitude > 180.0) {
+ var longitude = descent[x].longitude - 360.0;
+ } else {
+ var longitude = descent[x].longitude;
+ }
+ predictionPath.push([descent[x].latitude, longitude]);
+ };
+ var burstPoint = ascent[ascent.length-1];
+ var landingPoint = descent[descent.length-1];
+
+ plot.predictionPath = new L.polyline(predictionPath, {color: 'red'}).addTo(map);
+
+ burstIconImage = host_url + markers_url + "balloon-pop.png";
+
+ burstIcon = new L.icon({
+ iconUrl: burstIconImage,
+ iconSize: [20,20],
+ iconAnchor: [10, 10],
+ });
+
+ if (burstPoint.longitude > 180.0) {
+ var burstLongitude = burstPoint.longitude - 360.0;
+ } else {
+ var burstLongitude = burstPoint.longitude;
+ }
+
+ plot.burstMarker = new L.marker([burstPoint.latitude, burstLongitude], {
+ icon: burstIcon
+ }).addTo(map);
+
+ var burstTime = new Date(burstPoint.datetime);
+ var burstTooltip = "Time: " + burstTime.toLocaleString() + "
Altitude: " + Math.round(burstPoint.altitude) + "m";
+ plot.burstMarker.bindTooltip(burstTooltip, {offset: [5,0]});
+
+ if (landingPoint.longitude > 180.0) {
+ var landingLongitude = landingPoint.longitude - 360.0;
+ } else {
+ var landingLongitude = landingPoint.longitude;
+ }
+
+ plot.landingMarker = new L.marker([landingPoint.latitude, landingLongitude], {
+ icon: new L.NumberedDivIcon({number: dates.indexOf(data.request.launch_datetime)+1})
+ }).addTo(map);
+
+ var landingTime = new Date(landingPoint.datetime);
+ if (properties[3] != "" && properties[4] != "") {
+ var landingTooltip = "Time: " + landingTime.toLocaleString() + "
Model Dataset: " + data.request.dataset +
+ "
Model Assumptions:
- " + data.request.ascent_rate + "m/s ascent
- " + data.request.burst_altitude + "m burst altitude (" + properties[3] + " samples)
- " + data.request.descent_rate + "m/s descent (" + properties[4] + " samples)";
+ } else {
+ var landingTooltip = "Time: " + landingTime.toLocaleString() + "
Model Dataset: " + data.request.dataset +
+ "
Model Assumptions:
- " + data.request.ascent_rate + "m/s ascent
- " + data.request.burst_altitude + "m burst altitude
- " + data.request.descent_rate + "m/s descent";
+ }
+ plot.landingMarker.bindTooltip(landingTooltip, {offset: [13,-28]});
+}
+
+function showPrediction(url) {
+ return $.ajax({
+ type: "GET",
+ url: url,
+ dataType: "json",
+ });
+}
+
+function deletePredictions(marker) {
+ if (launchPredictions.hasOwnProperty(marker)) {
+ for (var prediction in launchPredictions[marker]) {
+ if (launchPredictions[marker].hasOwnProperty(prediction)) {
+ for (var object in launchPredictions[marker][prediction]) {
+ if (launchPredictions[marker][prediction].hasOwnProperty(object)) {
+ map.removeLayer(launchPredictions[marker][prediction][object]);
+ }
+ }
+ }
+ }
+ }
+ var popup = launches.getLayer(marker).getPopup();
+ var popupContent = popup.getContent();
+ if (popupContent.includes("Delete")) {
+ popupContent = popupContent.split("