use alias when airport has no ICAO code
This commit is contained in:
parent
53afd1ee77
commit
f3792db230
1 changed files with 13 additions and 4 deletions
13
index.html
13
index.html
|
@ -85,14 +85,23 @@
|
|||
|
||||
const features_nav = new Array();
|
||||
const features_local = new Array();
|
||||
const airport_name_to_ident = {
|
||||
"Norberg": "SE-0004"
|
||||
};
|
||||
for(const line of lines) {
|
||||
const [from, to] = line.split(',');
|
||||
|
||||
const fromAirport = airportsData[from];
|
||||
const toAirport = airportsData[to];
|
||||
let fromAirport = airportsData[from];
|
||||
let toAirport = airportsData[to];
|
||||
|
||||
if(!fromAirport) {
|
||||
fromAirport = airportsData[airport_name_to_ident[from]];
|
||||
if(!fromAirport) { alert(`Airport ${from} not found`); return; }
|
||||
}
|
||||
if(!toAirport) {
|
||||
toAirport = airportsData[airport_name_to_ident[to]];
|
||||
if(!toAirport) { alert(`Airport ${to} not found`); return; }
|
||||
}
|
||||
|
||||
const fromLongitude = parseFloat(fromAirport.longitude);
|
||||
const fromLatitude = parseFloat(fromAirport.latitude);
|
||||
|
|
Loading…
Reference in a new issue