show local flights (departure == arrival) as points
This commit is contained in:
parent
07c9e50a9f
commit
e48882bf49
1 changed files with 32 additions and 9 deletions
41
index.html
41
index.html
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue