diff --git a/client/src/pages/atlas/useAtlas.ts b/client/src/pages/atlas/useAtlas.ts index 6e5f2422..d8dee913 100644 --- a/client/src/pages/atlas/useAtlas.ts +++ b/client/src/pages/atlas/useAtlas.ts @@ -141,7 +141,10 @@ export function useAtlas() { for (const f of geo.features) { const a2 = f.properties?.ISO_A2 const a3 = f.properties?.ADM0_A3 || f.properties?.ISO_A3 - if (a2 && a3 && a2 !== '-99' && a3 !== '-99' && !A2_TO_A3[a2]) { + // Only real 2-letter ISO codes: natural-earth uses subdivision-style + // values like "CN-TW" for Taiwan, which would otherwise overwrite the + // legitimate TWN->TW reverse mapping and break the country (#1049). + if (a2 && a3 && a2.length === 2 && a2 !== '-99' && a3 !== '-99' && !A2_TO_A3[a2]) { A2_TO_A3[a2] = a3 } }