diff --git a/public_html/layers.js b/public_html/layers.js
index 22383d84..d0cd7b19 100644
--- a/public_html/layers.js
+++ b/public_html/layers.js
@@ -13,7 +13,7 @@ function createBaseLayers() {
// ------------------------------------------------------------
if (ShowAdditionalMaps) {
world.push(new ol.layer.Tile({
- source: new ol.source.OSM({
+ source: new ol.source.OSM({ // ref: Github issue #18
"url": "https://tiles.stadiamaps.com/tiles/stamen_terrain/{z}/{x}/{y}@2x.png",
"attributions": [
'© Stadia Maps',
diff --git a/public_html/planeObject.js b/public_html/planeObject.js
index 90f4a9ac..48a499ab 100644
--- a/public_html/planeObject.js
+++ b/public_html/planeObject.js
@@ -49,18 +49,19 @@ function PlaneObject(icao) {
// Akissack - additional variables for various modifications - Ref: AK9Z Start incl.
this.is_vetted = false;
this.is_interesting = ""; // 'Y' or not
- this.my_vet = ""; // 1 = Mil/noTrail 2 = Civ/noTrail 5 = Mil/Trail 6 = Civ/Trail 0 = ?/noTrail 3,4,7 = ERR
- this.my_trail = ""; // trail on by default
- this.ac_type = ""; // icao type
- this.ac_shortname = ""; // Short a/c name
- this.ac_aircraft = ""; // Long a/c name
- this.ac_category = ""; // My category for images - eg 2prop
+ this.my_vet = ""; // 1 = Mil/noTrail 2 = Civ/noTrail 5 = Mil/Trail 6 = Civ/Trail 0 = ?/noTrail 3,4,7 = ERR
+ this.my_trail = ""; // trail on by default
+ this.ac_type = ""; // icao type
+ this.ac_shortname = ""; // Short a/c name
+ this.ac_aircraft = ""; // Long a/c name
+ this.ac_category = ""; // My category for images - eg 2prop
this.ac_country = "";
this.ac_operator = "-";
// Akissack - additional variables for various modifications - Ref: AK9Z Ends
- this.siteBearing = 0; // ref: AK8F
- this.siteNm = 0; // ref: AK8F
- this.fl = 0; // ref: AK8F
+ this.siteBearing = 0; // ref: AK8F
+ this.siteBearingSlot = 0; // ref: Github issue #17
+ this.siteNm = 0; // ref: AK8F
+ this.fl = 0; // ref: AK8F
// start from a computed registration, let the DB override it
// if it has something else.
@@ -641,15 +642,40 @@ PlaneObject.prototype.updateData = function (receiver_timestamp, data) {
//this.sitedist = WGS84.haversineDistance(SitePosition, this.position);
// AKISSACK - Store a bearing and nm distance for our range plot Ref AK8G
this.sitedist = ol.sphere.getDistance(SitePosition, this.position);
- this.siteBearing = parseInt(
- getBearing(
+
+ // increased the resolution from one degree to half-degree // ref: Github issue #17
+
+ this.siteBearing = getBearing(
SitePosition[1],
SitePosition[0],
this.position[1],
this.position[0]
- ).toFixed(0)
- );
- this.siteNm = parseInt((this.sitedist / 1852).toFixed(0));
+ ).toFixed(1);
+
+ this.siteBearingSlot = Math.round(2 * this.siteBearing);
+ if (this.siteBearingSlot == 720) this.siteBearingSlot=0;
+
+ //this.siteBearingSlot = Math.round(2 * getBearing(
+ // SitePosition[1],
+ // SitePosition[0],
+ // this.position[1],
+ // this.position[0]
+ //).toFixed(1));
+
+ //this.siteBearing = parseInt(
+ // getBearing(
+ // SitePosition[1],
+ // SitePosition[0],
+ // this.position[1],
+ // this.position[0]
+ // ).toFixed(0)
+ //);
+
+ this.siteNm = parseInt((this.sitedist / 1852).toFixed(1));
+
+ //if (this.icao.substring(0,5) == "43c74"){
+ // console.log(this.icao+" bearing: "+this.siteBearing+" slot: "+this.siteBearingSlot +" , range: "+this.siteNm);
+ //}
}
this.position_from_mlat = false;
@@ -706,10 +732,10 @@ PlaneObject.prototype.updateTick = function (
// MINUMUM RANGE RINGS - MinRangeHeight is set in config.js as the upper bound for this ring
// - MinRangeLikely is set in config.js and is maximum likely distance for MinRangeHeight
if (this.altitude <= MinRangeHeight) {
- if (MinRngRange[this.siteBearing] < this.siteNm && this.siteNm < MinRangeLikely) { // Update sessionStorage and also update MariaDb if in use
- MinRngRange[this.siteBearing] = this.siteNm;
- MinRngLat[this.siteBearing] = this.position[1];
- MinRngLon[this.siteBearing] = this.position[0];
+ if (MinRngRange[this.siteBearingSlot] < this.siteNm && this.siteNm < MinRangeLikely) { // Update sessionStorage and also update MariaDb if in use
+ MinRngRange[this.siteBearingSlot] = this.siteNm;
+ MinRngLat[this.siteBearingSlot] = this.position[1];
+ MinRngLon[this.siteBearingSlot] = this.position[0];
if (TypeOfStorageSession == 'Session') {
sessionStorage.setItem("MinRngRange", JSON.stringify(MinRngRange));
sessionStorage.setItem("MinRngLat", JSON.stringify(MinRngLat));
@@ -719,9 +745,9 @@ PlaneObject.prototype.updateTick = function (
localStorage.setItem("MinRngLat", JSON.stringify(MinRngLat));
localStorage.setItem("MinRngLon", JSON.stringify(MinRngLon));
}
- //console.log(("000" + this.siteBearing).slice(-3) + "° " + ("000" + this.siteNm).slice(-3)+"nm logged as MIN");
+ //console.log("slot: "+this.siteBearingSlot+" "+("000" + this.siteBearing).slice(-5) + "° " + ("000" + this.siteNm).slice(-3)+"nm logged as MIN range.");
if (SleafordMySql) {
- //console.log(("000" + this.siteBearing).slice(-3) + "° " + ("000" + this.siteNm).slice(-3)+"nm logged as MID "+this.fl);
+ //console.log(("000" + this.siteBearingSlot).slice(-3) + "° " + ("000" + this.siteNm).slice(-3)+"nm logged as MID "+this.fl);
updateMySqlRange(
"min",
this.siteBearing,
@@ -738,10 +764,10 @@ PlaneObject.prototype.updateTick = function (
// MIDDLE RANGE RINGS - MidRangeHeight is set in config.js as the upper bound for this ring
// - MidRangeLikely is set in config.js and is maximum likely distance for MidRangeHeight
if (this.altitude <= MidRangeHeight) {
- if (MidRngRange[this.siteBearing] < this.siteNm && this.siteNm < MidRangeLikely) {
- MidRngRange[this.siteBearing] = this.siteNm;
- MidRngLat[this.siteBearing] = this.position[1];
- MidRngLon[this.siteBearing] = this.position[0];
+ if (MidRngRange[this.siteBearingSlot] < this.siteNm && this.siteNm < MidRangeLikely) {
+ MidRngRange[this.siteBearingSlot] = this.siteNm;
+ MidRngLat[this.siteBearingSlot] = this.position[1];
+ MidRngLon[this.siteBearingSlot] = this.position[0];
if (TypeOfStorageSession == 'Session') {
sessionStorage.setItem("MidRngRange", JSON.stringify(MidRngRange));
sessionStorage.setItem("MidRngLat", JSON.stringify(MidRngLat));
@@ -751,7 +777,7 @@ PlaneObject.prototype.updateTick = function (
localStorage.setItem("MidRngLat", JSON.stringify(MidRngLat));
localStorage.setItem("MidRngLon", JSON.stringify(MidRngLon));
}
- //console.log(("000" + this.siteBearing).slice(-3) + "° " + ("000" + this.siteNm).slice(-3)+"nm logged as MID");
+ //console.log("slot: "+this.siteBearingSlot+" "+("000" + this.siteBearing).slice(-5) + "° " + ("000" + this.siteNm).slice(-3)+"nm logged as MID range.");
if (SleafordMySql) {
//console.log(("000" + this.siteBearing).slice(-3) + "° " + ("000" + this.siteNm).slice(-3)+"nm logged as MID "+this.altitude);
updateMySqlRange(
@@ -771,10 +797,10 @@ PlaneObject.prototype.updateTick = function (
// - MaxRangeLikely is set in config.js and is maximum likely distance for MaxRangeHeight
// - These are theoretical absolute maximums to weed out bad plots
if (this.altitude <= MaxRangeHeight) {
- if (MaxRngRange[this.siteBearing] < this.siteNm && this.siteNm < MaxRangeLikely) {
- MaxRngRange[this.siteBearing] = this.siteNm;
- MaxRngLat[this.siteBearing] = this.position[1];
- MaxRngLon[this.siteBearing] = this.position[0];
+ if (MaxRngRange[this.siteBearingSlot] < this.siteNm && this.siteNm < MaxRangeLikely) {
+ MaxRngRange[this.siteBearingSlot] = this.siteNm;
+ MaxRngLat[this.siteBearingSlot] = this.position[1];
+ MaxRngLon[this.siteBearingSlot] = this.position[0];
if (TypeOfStorageSession == 'Session') {
sessionStorage.setItem("MaxRngRange", JSON.stringify(MaxRngRange));
sessionStorage.setItem("MaxRngLat", JSON.stringify(MaxRngLat));
@@ -784,7 +810,7 @@ PlaneObject.prototype.updateTick = function (
localStorage.setItem("MaxRngLat", JSON.stringify(MaxRngLat));
localStorage.setItem("MaxRngLon", JSON.stringify(MaxRngLon));
}
- //console.log(("000" + this.siteBearing).slice(-3) + "° " + ("000" + this.siteNm).slice(-3)+"nm logged as MAX");
+ //console.log("slot: "+this.siteBearingSlot+" "+("000" + this.siteBearing).slice(-5) + "° " + ("000" + this.siteNm).slice(-3)+"nm logged as MAX range.");
if (SleafordMySql) {
//console.log(("000" + this.siteBearing).slice(-3) + "° " + ("000" + this.siteNm).slice(-3)+"nm logged as MAX "+this.altitude);
updateMySqlRange(
@@ -1057,7 +1083,7 @@ function radians(n) {
return n * (Math.PI / 180);
}
-function degrees(n) {
+function degrees(n) { //degrees to radians
return n * (180 / Math.PI);
}
@@ -1077,7 +1103,7 @@ function getBearing(startLat, startLong, endLat, endLong) {
if (Math.abs(dLong) > Math.PI) {
if (dLong > 0.0) dLong = -(2.0 * Math.PI - dLong);
else dLong = 2.0 * Math.PI + dLong;
- }
+ };
return (degrees(Math.atan2(dLong, dPhi)) + 360.0) % 360.0;
}
diff --git a/public_html/script.js b/public_html/script.js
index 89a6d791..db0076d2 100644
--- a/public_html/script.js
+++ b/public_html/script.js
@@ -326,7 +326,7 @@ function initialize() {
MaxRngRange = JSON.parse(sessionStorage.getItem("MaxRngRange"));
} else {
//console.log("Setting up max range");
- for (var j = 0; j < 360; j++) {
+ for (var j = 0; j < 720; j++) {
MaxRngRange[j] = 0;
MaxRngLat[j] = SiteLat;
MaxRngLon[j] = SiteLon;
@@ -339,7 +339,7 @@ function initialize() {
MidRngLon = JSON.parse(sessionStorage.getItem("MidRngLon"));
MidRngRange = JSON.parse(sessionStorage.getItem("MidRngRange"));
} else {
- for (var j = 0; j < 360; j++) {
+ for (var j = 0; j < 720; j++) {
MidRngRange[j] = 0;
MidRngLat[j] = SiteLat;
MidRngLon[j] = SiteLon;
@@ -352,7 +352,7 @@ function initialize() {
MinRngLon = JSON.parse(sessionStorage.getItem("MinRngLon"));
MinRngRange = JSON.parse(sessionStorage.getItem("MinRngRange"));
} else {
- for (var j = 0; j < 360; j++) {
+ for (var j = 0; j < 720; j++) {
MinRngRange[j] = 0;
MinRngLat[j] = SiteLat;
MinRngLon[j] = SiteLon;
@@ -366,7 +366,7 @@ function initialize() {
MaxRngRange = JSON.parse(localStorage.getItem("MaxRngRange"));
} else {
//console.log("Setting up max range");
- for (var j = 0; j < 360; j++) {
+ for (var j = 0; j < 720; j++) {
MaxRngRange[j] = 0;
MaxRngLat[j] = SiteLat;
MaxRngLon[j] = SiteLon;
@@ -379,7 +379,7 @@ function initialize() {
MidRngLon = JSON.parse(localStorage.getItem("MidRngLon"));
MidRngRange = JSON.parse(localStorage.getItem("MidRngRange"));
} else {
- for (var j = 0; j < 360; j++) {
+ for (var j = 0; j < 720; j++) {
MidRngRange[j] = 0;
MidRngLat[j] = SiteLat;
MidRngLon[j] = SiteLon;
@@ -392,7 +392,7 @@ function initialize() {
MinRngLon = JSON.parse(localStorage.getItem("MinRngLon"));
MinRngRange = JSON.parse(localStorage.getItem("MinRngRange"));
} else {
- for (var j = 0; j < 360; j++) {
+ for (var j = 0; j < 720; j++) {
MinRngRange[j] = 0;
MinRngLat[j] = SiteLat;
MinRngLon[j] = SiteLon;
@@ -1106,13 +1106,14 @@ function initialize_map() {
})
);
+ //console.log ("Finds: " + ShowMyFindsLayer +" "+ SleafordMySql);
if (ShowMyFindsLayer && SleafordMySql) {
// AKISSACK Ref: AK9U
var myLayer = new ol.layer.Vector({
name: "my_layer",
type: "overlay",
- title: "My Layer",
+ title: "Finds",
source: new ol.source.Vector({
features: MyFeatures,
}),
@@ -1129,7 +1130,6 @@ function initialize_map() {
MapType = localStorage["MapType"];
if (MapType === undefined) {
console.log("MapType local is " + MapType);
-
MapType = "osm_light";
}
console.log("MapType is " + MapType);
@@ -1539,18 +1539,24 @@ function initialize_map() {
),
name: findname + "
" + findnumber,
});
- if (findicon === "coin") {
- f.setStyle(fCoin);
- } else if (findicon === "coins") {
- f.setStyle(fCoins);
- } else if (findicon === "coinr") {
- f.setStyle(fCoinr);
- } else if (findicon === "mil") {
- f.setStyle(fMil);
- } else if (findicon === "spec") {
- f.setStyle(fSpec);
- } else if (findicon === "spader") {
- f.setStyle(fSpader);
+
+ //Simpler iconisation
+ if (findname.startsWith("Coin")){
+ f.setStyle(fCoin);
+ //}
+
+ //if (findicon === "coin") {
+ // f.setStyle(fCoin);
+ //} else if (findicon === "coins") {
+ // f.setStyle(fCoins);
+ //} else if (findicon === "coinr") {
+ // f.setStyle(fCoinr);
+ //} else if (findicon === "mil") {
+ // f.setStyle(fMil);
+ //} else if (findicon === "spec") {
+ // f.setStyle(fSpec);
+ //} else if (findicon === "spader") {
+ // f.setStyle(fSpader);
} else {
f.setStyle(fSpade);
}
@@ -2361,7 +2367,7 @@ function refreshTableInfo() {
});
var polyCoords = [];
- for (var i = 0; i < 360; i++) {
+ for (var i = 0; i < 720; i++) {
polyCoords.push(
ol.proj.transform([MaxRngLon[i], MaxRngLat[i]], "EPSG:4326", "EPSG:3857")
);
@@ -2385,7 +2391,7 @@ function refreshTableInfo() {
}),
});
var polyCoords = [];
- for (var i = 0; i < 360; i++) {
+ for (var i = 0; i < 720; i++) {
polyCoords.push(
ol.proj.transform([MidRngLon[i], MidRngLat[i]], "EPSG:4326", "EPSG:3857")
);
@@ -2409,7 +2415,7 @@ function refreshTableInfo() {
}),
});
var polyCoords = [];
- for (var i = 0; i < 360; i++) {
+ for (var i = 0; i < 720; i++) {
polyCoords.push(
ol.proj.transform([MinRngLon[i], MinRngLat[i]], "EPSG:4326", "EPSG:3857")
);
@@ -2770,7 +2776,7 @@ function resetMap() {
}
function resetRangePlot() {
- for (var j = 0; j < 360; j++) {
+ for (var j = 0; j < 720; j++) { // 360 --> 720 ref: Github issue #17
MaxRngRange[j] = 0;
MaxRngLat[j] = SiteLat;
MaxRngLon[j] = SiteLon;
@@ -2788,7 +2794,7 @@ function exportRangePlot() {
var rangemid = [];
var rangemin = [];
- for (var j = 0; j < 360; j++) {
+ for (var j = 0; j < 720; j++) { // 360 --> 720 ref: Github issue #17
rangemax[j] = [j, MaxRngRange[j], MaxRngLat[j], MaxRngLon[j]]
rangemid[j] = [j, MidRngRange[j], MidRngLat[j], MidRngLon[j]]
rangemin[j] = [j, MinRngRange[j], MinRngLat[j], MinRngLon[j]]
@@ -2802,15 +2808,13 @@ function exportRangePlot() {
const link = document.createElement("a");
- var blob = new Blob([datamax], {
- type: "text/plain;charset=utf-8",
- }); // Create blob object with file content
+ var blob = new Blob([datamax], {type: "text/plain;charset=utf-8",}); // Create blob object with file content
link.href = URL.createObjectURL(blob); // Add file content in the object URL
link.download = "maxRange.json"; // Add file name
link.click(); // Add click event to tag to save file.
URL.revokeObjectURL(link.href);
- setTimeout(function(){
+ setTimeout(function(){ // ref: Github issue #19
blob = new Blob([datamid], {type: "text/plain;charset=utf-8",});
link.href = URL.createObjectURL(blob);
link.download = "midRange.json";
@@ -2822,9 +2826,9 @@ function exportRangePlot() {
link.download = "minRange.json";
link.click();
URL.revokeObjectURL(link.href);
- },5000); //delay is in milliseconds
+ },3000); //delay is in milliseconds
- },5000); //delay is in milliseconds
+ },3000); //delay is in milliseconds
}
@@ -2844,33 +2848,88 @@ function importRangePlot() {
}
function importMax(json) {
- //console.log(json);
- for (var j = 0; j < json.length; j++) {
- var obj = json[j];
- MaxRngRange[j] = obj[1];
- MaxRngLat[j] = obj[2];
- MaxRngLon[j] = obj[3]
- }
- //console.log("data.json read " + MaxRngRange);
+ //console.log(json.length);
+ if (json.length === 360) {
+ for (var j = 0; j < json.length; j++) {
+ var obj = json[j];
+ var rslot = 2 * obj[0];
+ var rslotnew = rslot +1 ;
+ MaxRngRange[rslot] = obj[1];
+ MaxRngLat[rslot] = obj[2];
+ MaxRngLon[rslot] = obj[3]
+
+ MaxRngRange[rslotnew] = obj[1];
+ MaxRngLat[rslotnew] = obj[2];
+ MaxRngLon[rslotnew] = obj[3]
+ }
+ } else { // 360 --> 720 ref: Github issue #17
+ for (var j = 0; j < json.length; j++) {
+ var obj = json[j];
+ MaxRngRange[obj[0]] = obj[1];
+ MaxRngLat[obj[0]] = obj[2];
+ MaxRngLon[obj[0]] = obj[3]
+ }
+ }
+ //console.log(MaxRngRange +" "+MaxRngLat+" "+MaxRngLon);
}
function importMid(json) {
- for (var j = 0; j < json.length; j++) {
- var obj = json[j];
- MidRngRange[j] = obj[1];
- MidRngLat[j] = obj[2];
- MidRngLon[j] = obj[3]
- }
+ if (json.length === 360) {
+ for (var j = 0; j < json.length; j++) {
+ var obj = json[j];
+ var rslot = 2 * obj[0];
+ var rslotnew = rslot +1 ;
+ MidRngRange[rslot] = obj[1];
+ MidRngLat[rslot] = obj[2];
+ MidRngLon[rslot] = obj[3]
+
+ MidRngRange[rslotnew] = obj[1];
+ MidRngLat[rslotnew] = obj[2];
+ MidRngLon[rslotnew] = obj[3]
+ }
+ } else { // 360 --> 720 ref: Github issue #17
+ for (var j = 0; j < json.length; j++) {
+ var obj = json[j];
+ MidRngRange[obj[0]] = obj[1];
+ MidRngLat[obj[0]] = obj[2];
+ MidRngLon[obj[0]] = obj[3]
+ }
+ }
}
function importMin(json) {
- for (var j = 0; j < json.length; j++) {
- var obj = json[j];
- MinRngRange[j] = obj[1];
- MinRngLat[j] = obj[2];
- MinRngLon[j] = obj[3]
- }
-}
+ if (json.length === 360) {
+ for (var j = 0; j < json.length; j++) {
+ var obj = json[j];
+ var rslot = 2 * obj[0];
+ var rslotnew = rslot +1 ;
+ MinRngRange[rslot] = obj[1];
+ MinRngLat[rslot] = obj[2];
+ MinRngLon[rslot] = obj[3]
+
+ MinRngRange[rslotnew] = obj[1];
+ MinRngLat[rslotnew] = obj[2];
+ MinRngLon[rslotnew] = obj[3]
+ }
+ } else { // 360 --> 720 ref: Github issue #17
+ for (var j = 0; j < json.length; j++) {
+ var obj = json[j];
+ MinRngRange[obj[0]] = obj[1];
+ MinRngLat[obj[0]] = obj[2];
+ MinRngLon[obj[0]] = obj[3]
+ }
+ }
+}
+
+
+//function importMin(json) {
+// for (var j = 0; j < json.length; j++) {
+// var obj = json[j];
+// MinRngRange[obj[0]] = obj[1];
+// MinRngLat[obj[0]] = obj[2];
+// MinRngLon[obj[0]] = obj[3]
+// }
+//}
function updateMapSize() {
OLMap.updateSize();