Every capital in the Americas: the eastern Caribbean, Central America, the Guianas, Haiti, Sucre

Saint John's, Basseterre, Roseau, Castries, Kingstown and Saint George's land
ECFS and Southern Caribbean Fiber in their real order (the old pairs stay for
saves), with Flow and Digicel on every island. San Salvador, Tegucigalpa and
Managua get Claro and Tigo; Belize, Guyana, Suriname and Haiti their national
telcos (BTL, GTT, Telesur, Natcom, real ASNs). Sucre, Bolivia's constitutional
capital, has no facility, so it is a W3 exception.

Guyana and Suriname land SG-SCS, Deep Blue One and X-Link; Haiti Fibralink to
Jamaica and the Bahamas' BDSNi, and shares Hispaniola with the Dominican
Republic. The six islands' coastlines come from Natural Earth 1:50m, like
Cebu's. Exchanges only where PeeringDB lists one with members.

tests/capitals.test.js checks the Americas' 35 capitals.
This commit is contained in:
Frederic Jung 2026-11-03 19:11:56 +01:00
parent 017eba4ca2
commit c5c0d853ae
No known key found for this signature in database
18 changed files with 229 additions and 12 deletions

43
tests/capitals.test.js Normal file
View file

@ -0,0 +1,43 @@
// Every UN member's capital is a city on the map (Vatican City is served from Rome, five kilometres away). Each region's
// list grows as its capitals arrive; a capital is there when a city of that country sits within 25 km of it.
const test = require('node:test');
const assert = require('node:assert/strict');
const { load } = require('./harness');
const { ev } = load();
const cities = JSON.parse(ev('JSON.stringify(CITIES.filter(c=>!c.off).map(c=>({id:c.id,cc:c.cc,ll:[c.lon,c.lat],capital:!!c.capital})))'));
const R = Math.PI / 180, km = (a, b) => 6371 * Math.acos(Math.min(1, Math.sin(a[1] * R) * Math.sin(b[1] * R) + Math.cos(a[1] * R) * Math.cos(b[1] * R) * Math.cos((a[0] - b[0]) * R)));
const missing = (caps) => Object.entries(caps).filter(([k, ll]) => !cities.some((c) => c.cc === k.slice(0, 2) && km(c.ll, ll) < 25)).map(([k]) => k);
const AMERICAS = {
'AG Saint John\'s': [-61.85, 17.12], 'BS Nassau': [-77.35, 25.05], 'BB Bridgetown': [-59.62, 13.10], 'BZ Belmopan': [-88.77, 17.25], 'BO Sucre': [-65.26, -19.03],
'BR Brasília': [-47.88, -15.79], 'CA Ottawa': [-75.70, 45.42], 'CL Santiago': [-70.67, -33.45], 'CO Bogotá': [-74.07, 4.71], 'CR San José': [-84.08, 9.93],
'CU Havana': [-82.37, 23.11], 'DM Roseau': [-61.39, 15.30], 'DO Santo Domingo': [-69.93, 18.49], 'EC Quito': [-78.47, -0.18], 'SV San Salvador': [-89.19, 13.69],
'GD Saint George\'s': [-61.75, 12.05], 'GT Guatemala City': [-90.51, 14.63], 'GY Georgetown': [-58.16, 6.80], 'HT Port-au-Prince': [-72.34, 18.54],
'HN Tegucigalpa': [-87.19, 14.07], 'JM Kingston': [-76.79, 17.97], 'MX Mexico City': [-99.13, 19.43], 'NI Managua': [-86.25, 12.13], 'PA Panama City': [-79.52, 8.98],
'PY Asunción': [-57.58, -25.26], 'PE Lima': [-77.04, -12.05], 'KN Basseterre': [-62.72, 17.30], 'LC Castries': [-60.99, 14.01], 'VC Kingstown': [-61.22, 13.16],
'SR Paramaribo': [-55.20, 5.85], 'TT Port of Spain': [-61.51, 10.66], 'US Washington': [-77.04, 38.91], 'UY Montevideo': [-56.16, -34.90], 'VE Caracas': [-66.90, 10.49],
'AR Buenos Aires': [-58.38, -34.60],
};
test('every capital of the Americas is a city', () => {
assert.equal(Object.keys(AMERICAS).length, 35, 'the 35 UN members of the Americas');
assert.deepEqual(missing(AMERICAS), []);
});
test('capitals are flagged, so the density rule lets small ones sit near a big city', () => {
const unflagged = Object.entries(AMERICAS).map(([k, ll]) => cities.find((c) => c.cc === k.slice(0, 2) && km(c.ll, ll) < 25))
.filter((c) => c && !['BS', 'BB', 'BR', 'CA', 'CL', 'CO', 'CR', 'CU', 'DO', 'EC', 'GT', 'JM', 'MX', 'PA', 'PY', 'PE', 'TT', 'US', 'UY', 'VE', 'AR'].includes(c.cc)).filter((c) => !c.capital).map((c) => c.id);
assert.deepEqual(unflagged, []);
});
test('the eastern Caribbean: Flow and Digicel on every island, each landing ECFS and Southern Caribbean Fiber', () => {
for (const c of ['anu', 'bas', 'dom', 'slu', 'svd', 'gnd']) {
assert.ok(ev(`NET.llt.pops.includes('${c}')&&NET.dgc.pops.includes('${c}')`), `${c}: Flow and Digicel`);
assert.ok(ev(`CABLE_PAIRS.some(p=>p.cid==='ecfs'&&(p.a==='${c}'||p.b==='${c}'))&&CABLE_PAIRS.some(p=>p.cid==='scf'&&(p.a==='${c}'||p.b==='${c}'))`), `${c}: both cables`);
assert.ok(ev(`NETS.some(n=>sellsAt(n,'${c}'))`), `${c}: someone sells transit`);
}
// the old pairs stay, so links in old saves keep their cable
assert.ok(ev("CABLE_PAIRS.some(p=>p.cid==='ecfs'&&p.a==='sju'&&p.b==='fdf')"));
assert.ok(ev("isSub('pap','sdq')") === false, 'Haiti and the Dominican Republic share Hispaniola');
});

View file

@ -23,6 +23,7 @@ const EXCEPTIONS = {
ivc: 'Invercargill waits for its AI campus; nobody sells transit there yet',
pcn: 'Pitcairn: no cable, no network, land your own (#124)',
prr: 'Prince Rupert is a remote town with no carrier in it',
sre: "Sucre has no exchange or carrier facility: Bolivia's transit is bought in La Paz",
stg: 'Stuttgart is the Only Spätzle-IX scenario city: peering only, by design (#114)',
yfb: 'Iqaluit has no fiber, only satellite: land your own cable (the real plan runs from Nuuk)',
yyj: 'Victoria buys from Telus and Rogers, consumer networks only in the game: link it from Vancouver',
@ -95,11 +96,11 @@ const REAL_NAMES = [
// content and clouds
'Akamai', 'Alibaba Cloud', 'Amazon', 'Amazon Web Services', 'AWS', 'Baidu', 'ByteDance', 'Cloudflare', 'Facebook', 'Fastly', 'Google', 'Mercado Libre', 'Meta', 'Microsoft', 'Netflix', 'Tencent', 'TikTok', 'VK', 'VKontakte', 'Yandex',
// eyeballs and incumbents
'A1', 'A1 Telekom Austria', 'AIS', 'Airtel', 'Algérie Télécom', 'Altibox', 'Altice', 'America Movil', 'Angola Cables', 'Antel', 'ASTCA', 'Aussie Broadband', 'Bell', 'Bell Canada', 'Belong', 'Bemobile', 'Brisanet', 'BT', 'BTC', 'Cable & Wireless', 'Cable Bahamas', "CAN'L", 'Canal+', 'CANTV', 'CelcomDigi', 'China Mobile', 'China Telecom', 'China Unicom', 'Chunghwa Telecom', 'Citymesh', 'Claro', 'Comcast', 'Cosmote', 'Cox', 'CV Telecom', 'Deutsche Telekom', 'Dhiraagu', 'Dialog', 'Digi', 'Digicel', 'Djezzy', 'Djibouti Telecom', 'DNA', 'Docomo', 'Docomo Pacific', 'Dodo', 'du', 'Eastlink', 'Elisa', 'Emtel', 'Entel', 'ER-Telecom', 'Etisalat', 'ETECSA', 'Ethio Telecom', 'Exetel', 'Far EasTone', 'Fastweb', 'FINTEL', 'Flow', 'Free', 'Frontier', 'GCI', 'Globe', 'Google Fiber', 'Grameenphone', 'GSL Networks', 'GTA', 'Hawaiian Telcom', 'HKBN', 'HKT', 'iiNet', 'Jazz', 'Jio', 'KDDI', 'KPN', 'KT', 'Kyivstar', 'Launtel', 'Leaptel', 'LG U+', 'Liberty Latin America', 'lifecell', 'LMT', 'Magyar Telekom', 'Maroc Telecom', 'Mascom', 'Mauritius Telecom', 'MegaFon', 'MEO', 'Mobily', 'Movicel', 'Movistar', 'Movitel', 'MTC', 'MTN', 'mts', 'Neptune', 'Netvigator', 'Norlys', 'NOS', 'Nova', 'NTA', 'NTT Docomo', 'Oi', 'Omantel', 'One Communications', 'One NZ', 'Ooredoo', 'OPT', 'Optimum', 'Optus', 'Palau Mobile', 'Paradise Mobile', 'Pentanet', 'PLDT', 'PNCC', 'POST', 'Proximus', 'PTCL', 'Reliance Jio', 'Robi', 'Rogers', 'Rostelecom', 'Safaricom', 'SFR', 'Síminn', 'SK Broadband', 'Sky', 'SLT', 'Sonic', 'Spark', 'Spectrum', 'Spintel', 'Starlink', 'StarHub', 'STC', 'Superloop', 'Sure', 'Swisscom', 'T-Mobile', 'Tango', 'TCC', 'TDC', 'Tele2', 'Telecel', 'Telecom Argentina', 'Telecom Egypt', 'Telecom Fiji', 'Telecom Namibia', 'Telekom Malaysia', 'Telekom Srbija', 'Telenet', 'Telenor', 'Telikom PNG', 'Telkomsel', 'Telma', 'Telmex', 'TelOne', 'Telstra', 'Telus', 'Tet', 'TIM', 'Tigo', 'TPG', 'True', 'True Move', 'TSTT', 'Turk Telekom', 'Unitel', 'UPC', 'Verizon', 'Viettel', 'Vini', 'Virgin Media', 'Vivacom', 'Vivo', 'VNPT', 'Vocus', 'Yas', 'Yettel', 'YouSee', 'Zeop',
', ', 'A1', 'A1 Telekom Austria', 'Airtel', 'AIS', 'Algérie Télécom', 'Altibox', 'Altice', 'America Movil', 'Angola Cables', 'Antel', 'ASTCA', 'Aussie Broadband', 'Belize Telemedia', 'Bell', 'Bell Canada', 'Belong', 'Bemobile', 'Brisanet', 'BT', 'BTC', 'Cable & Wireless', 'Cable Bahamas', 'Guyana Telephone & Telegraph', 'L", ', 'Natcom', 'SMART', 'Speednet', 'Telesur',
// exchanges and data centers
'AMS-IX', 'Any2', 'BCIX', 'CoreSite', 'DE-CIX', 'DigiCo', 'Digital Realty', 'Equinix', 'France-IX', 'Interxion', 'iseek', 'IX.br', 'JPIX', 'LINX', 'NAPAfrica', 'NetIX', 'NEXTDC', 'NIX', 'NL-ix', 'SIX', 'Telehouse',
'AMS-IX', 'Any2', 'BCIX', 'CoreSite', 'DANIX', 'DE-CIX', 'DigiCo', 'Digital Realty', 'Equinix', 'France-IX', 'GREX', 'HIX', 'Interxion', 'iseek', 'IX.br', 'IXP-HN', 'JPIX', 'LINX', 'NAPAfrica', 'NetIX', 'NEXTDC', 'NIX', 'NL-ix', 'SIX', 'SKNIX', 'SUR-IX', 'SVGIX', 'Telehouse',
// cables
'2Africa', 'Amitié', 'Darwin-Jakarta-Singapore Cable', 'Dunant', 'EllaLink', 'Equiano', 'Grace Hopper', 'Greenland Connect', 'Greenland Connect North', 'Hibernia Express', 'Jupiter', 'MAREA', 'North West Cable System', 'PEACE', 'SEA-ME-WE 6',
'2Africa', 'Amitié', 'BDSNi', 'CARCIP', 'Darwin-Jakarta-Singapore Cable', 'Deep Blue One', 'Dunant', 'Eastern Caribbean Fiber System', 'EllaLink', 'Equiano', 'Fibralink', 'Grace Hopper', 'Greenland Connect', 'Greenland Connect North', 'Hibernia Express', 'Jupiter', 'MAREA', 'North West Cable System', 'PEACE', 'SEA-ME-WE 6', 'SG-SCS', 'Southern Caribbean Fiber', 'X-Link',
// cable ships, their operators and maintenance clubs
'ACMA', 'ASEAN Explorer', 'ASEAN Protector', 'ASEAN Restorer', 'Cable Innovator', 'Cable Retriever', 'Global Marine', 'Léon Thévenin', 'MECMA', 'Orange Marine', 'Pierre de Fermat', 'René Descartes', 'SEAIOCMA', 'Sophie Germain', 'Sovereign', 'Wave Sentinel', 'Yokohama Zone',
// vendors