show local flights (departure == arrival) as points

This commit is contained in:
Louis 2024-04-19 12:05:40 +02:00
parent 07c9e50a9f
commit e48882bf49
1 changed files with 32 additions and 9 deletions

View File

@ -96,19 +96,31 @@
const toLongitude = parseFloat(toAirport.longitude);
const toLatitude = parseFloat(toAirport.latitude);
// if from == to, draw a point
var geometry;
if(fromAirport == toAirport) {
geometry = {
type: 'Point',
coordinates: [fromLongitude, fromLatitude]
};
}
else {
geometry = {
type: 'LineString',
coordinates: [
[fromLongitude, fromLatitude],
[toLongitude, toLatitude]
]
};
}
return {
type: 'Feature',
properties: {
from,
to
},
geometry: {
type: 'LineString',
coordinates: [
[fromLongitude, fromLatitude],
[toLongitude, toLatitude]
]
}
geometry: geometry
};
});
@ -129,10 +141,21 @@
'line-cap': 'round'
},
paint: {
'line-color': '#bd34eb',
'line-width': 4
'line-color': '#ce42f5',
'line-width': 2
}
});
map.addLayer({
id: 'points',
type: 'circle',
source: 'routes',
paint: {
'circle-radius': 5,
'circle-color': '#f00'
},
filter: ['==', '$type', 'Point']
});
}
function updateMap(csvData) {