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:
parent
d3f0a87f96
commit
79b0eb5730
1 changed files with 21 additions and 2 deletions
|
@ -49,8 +49,27 @@
|
||||||
onEachFeature : function(feature, layer) {
|
onEachFeature : function(feature, layer) {
|
||||||
if (feature.properties) {
|
if (feature.properties) {
|
||||||
var popupString = '<div class="popup">';
|
var popupString = '<div class="popup">';
|
||||||
for ( var k in feature.properties) {
|
for (var k in feature.properties) {
|
||||||
var v = feature.properties[k];
|
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 += k + ': ' + v + '<br />';
|
||||||
}
|
}
|
||||||
popupString += '</div>';
|
popupString += '</div>';
|
||||||
|
|
Loading…
Reference in a new issue