1
0
Fork 0

Phi: Fix runways and comms in leaflet popups

The popup of an airport showed:
runways: [Object object] [Object object] ....
This fix will instead print the runway's ID, ie:
runways: 08L, 26R, 08R, 26L

Same issue solved with communication frequencies.
This commit is contained in:
Hans Kunkell 2022-11-05 11:47:43 +01:00
parent d3f0a87f96
commit 79b0eb5730

View file

@ -49,8 +49,27 @@
onEachFeature : function(feature, layer) {
if (feature.properties) {
var popupString = '<div class="popup">';
for ( var k in feature.properties) {
var v = feature.properties[k];
for (var k in feature.properties) {
var v = ""
switch (k) {
case "runways":
var runways = new Array();
feature.properties.runways.forEach(element => {
runways.push(element.id);
});
v = runways.join(", ");
break;
case "comm":
var comm = new Array();
feature.properties.comm.forEach(element => {
comm.push(element.id+" ("+element.mhz+")");
});
v = comm.join(", ");
break;
default:
v = feature.properties[k];
break;
}
popupString += k + ': ' + v + '<br />';
}
popupString += '</div>';