v0.68.0: re-curate special remote airports — one per ~1000 km region (ISS-144)
CI / build + unit + e2e (pull_request) Successful in 13m18s

Greedy sparse selection replaces the blanket 1000km-from-large filter that
over-filled central Australia / Canada edges with dozens of tiny strips:
candidates sorted by scheduled service, type rank (medium < small < seaplane),
numeric id; accepted only if >= REMOTE_RADIUS_KM from every already-accepted
special. CSV: 1483 -> 1161 rows (1119 large unchanged, specials 364 -> 42).
New unit test pins the pairwise-sparsity invariant on the committed dataset.
This commit is contained in:
2026-09-23 20:33:25 +00:00
parent 65cbcf6e17
commit 49dfd2ca6e
5 changed files with 70 additions and 358 deletions
+23 -10
View File
@@ -3,10 +3,10 @@
//
// Pipeline: download → keep `large_airport` rows only (same density curation as the EU file,
// v0.2.8) → greedy 40 km haversine clustering → one airport per cluster ("the biggest").
// v0.61.0 (ISS-097): additionally keeps every non-large fixed-wing row that is REMOTE — no other
// airport within 1000 km of the kept set (lib/airports.ts isRemote) — so Antarctica, the high
// Arctic, Alaska, northern Canada and far islands are represented even though they carry no
// large_airport; same-station twins collapse via the same 40 km clustering.
// v0.68.0 (ISS-144): additionally keeps a sparse set of "special" remote airports — non-large
// fixed-wing rows with no large airport within 1000 km, greedily thinned to one per ~1000 km
// region (scheduled service + larger types preferred) so Antarctica, the high Arctic, Alaska,
// northern Canada and far islands are represented without over-filling empty regions.
// The output keeps the exact OurAirports header so lib/airports.ts parses it unchanged.
//
// Usage: node scripts/build-world-airports.mjs (writes data/airports_world.csv, prints stats)
@@ -141,12 +141,25 @@ for (const c of largeClusters) {
}
}
// v0.61.0 (ISS-097): "special" remote airports — every non-large fixed-wing row with no other
// airport within REMOTE_RADIUS_KM of the kept set joins the dataset, so empty regions get their
// real (small) airports instead of nothing. Same-station twins (two strips <40 km apart at one
// base) collapse via the same greedy clustering as above.
const remote = fixed.filter((r) => r.type !== 'large_airport' && isRemoteRow(r, kept));
const { winners: remoteKept } = clusterWinners(remote);
// v0.68.0 (ISS-144): "special" remote airports — one per ~REMOTE_RADIUS_KM region. Candidates are
// the non-large fixed-wing rows with no large airport within REMOTE_RADIUS_KM (unchanged), sorted
// by priority (scheduled service, then type rank medium < small < seaplane, then numeric id) and
// accepted greedily: a candidate joins only if it is at least REMOTE_RADIUS_KM from EVERY already
// accepted special — no special airport within 1000 km of another. One per ~1000 km region, so
// central Australia / Canada edges get a handful of well-chosen strips instead of dozens; this
// subsumes the old 40 km remote clustering (deleted).
const TYPE_RANK = { medium_airport: 0, small_airport: 1, seaplane_base: 2 }; // legacy 'airport' ranks last
const candidates = fixed.filter((r) => r.type !== 'large_airport' && isRemoteRow(r, kept));
candidates.sort(
(a, b) =>
Number(b.scheduled_service === 'yes') - Number(a.scheduled_service === 'yes') ||
(TYPE_RANK[a.type] ?? 3) - (TYPE_RANK[b.type] ?? 3) ||
Number(a.id) - Number(b.id),
);
const remoteKept = [];
for (const c of candidates) {
if (remoteKept.every((k) => haversineKm(c, k) >= REMOTE_RADIUS_KM)) remoteKept.push(c);
}
// --- Guards (fail loud before writing anything) ---
const finalRows = [...kept, ...remoteKept];