Better military plane ID

This commit is contained in:
2026-09-15 15:42:02 -04:00
parent 4c7a7fd1f5
commit 534dc6d2df
+7 -3
View File
@@ -23,6 +23,11 @@ const AIRLINES_URL = 'https://raw.githubusercontent.com/jpatokal/openflights/mas
const CARGO_OPERATORS = ['fedex', 'ups', 'dhl', 'cargo', 'freight', 'logistic', 'atlas air', 'kalitta', 'air freight'];
const PASSENGER_OPERATORS = ['airlines', 'airways', 'jetblue', 'easyjet', 'ryanair', 'delta', 'united', 'american', 'avianca', 'southwest', 'lufthansa', 'emirates', 'british'];
const MILITARY_CLASSES = ['H1M', 'H2M', 'L1M', 'L2M', 'L4M', 'A0'];
const MILITARY_KEYWORDS = [
'air force', 'airforce', 'navy', 'army', 'marine corps', 'coast guard',
'national guard', 'military', 'defence', 'defense', 'police', 'luftwaffe',
'aeronautica militare', 'armee de l air', 'raf', 'usaf'
];
let db;
let passengerOperators = PASSENGER_OPERATORS;
@@ -241,11 +246,10 @@ export function classifyAircraft(row) {
return value && list.some(k => value.includes(normalizeName(k)));
});
if (isMilitaryIcao(row.icao) || MILITARY_CLASSES.includes(row.class)) {
const operators = [row.operator, row.operatorCallsign, row.owner];
if (isMilitaryIcao(row.icao) || MILITARY_CLASSES.includes(row.class) || matchesAny(operators, MILITARY_KEYWORDS))
return 'military';
}
const operators = [row.operator, row.operatorCallsign];
if (row.categoryDescription?.toLowerCase().includes('cargo') || matchesAny(operators, CARGO_OPERATORS)) return 'cargo';
if (matchesAny(operators, passengerOperators)) return 'passenger';
if (row.owner && !row.operator) return 'private';