ADSB enrichment

This commit is contained in:
2026-06-25 11:09:06 -04:00
parent 3887654211
commit 86cdaab197

View File

@@ -81,8 +81,10 @@ export function decodeFlags(f) {
};
}
const lookupAircraft = (icao) =>
db?.prepare(`SELECT icao, reg, type_code, flags, desc FROM aircraft WHERE icao = ?`).get(icao.toUpperCase());
const lookupAircraft = (icao) => {
const clean = icao.replace(/^~/, '').toUpperCase().padStart(6, '0');
return db?.prepare(`SELECT icao, reg, type_code, flags, desc FROM aircraft WHERE icao = ?`).get(clean);
}
export function enrichAircraft(a) {
if(!a.hex) return a;