Skip to content

Instantly share code, notes, and snippets.

@indexzero
Last active March 26, 2022 21:21
Show Gist options
  • Save indexzero/11338529 to your computer and use it in GitHub Desktop.
Save indexzero/11338529 to your computer and use it in GitHub Desktop.
Where in the world is a good JSON mapping of all continents?
{
"Afghanistan": "Asia",
"Aland Islands": "Europe",
"Albania": "Europe",
"Algeria": "Africa",
"Andorra": "Europe",
"Angola": "Africa",
"Anguilla": "North America",
"Antigua and Barbuda": "North America",
"Argentina": "South America",
"Armenia": "Europe",
"Aruba": "North America",
"Australia": "Oceania",
"Austria": "Europe",
"Azerbaijan": "Europe",
"Bahamas": "North America",
"Bahamas, The": "North America",
"Bahrain": "Asia",
"Bangladesh": "Asia",
"Barbados": "North America",
"Belarus": "Europe",
"Belgium": "Europe",
"Belize": "North America",
"Benin": "Africa",
"Bermuda": "North America",
"Bhutan": "Asia",
"Bolivia": "South America",
"Bosnia and Herzegovina": "Europe",
"Botswana": "Africa",
"Bouvet Island": "South America",
"Brazil": "South America",
"British Indian Ocean Territory": "Asia",
"British Virgin Islands": "North America",
"Brunei": "Asia",
"Bulgaria": "Europe",
"Burkina": "Africa",
"Burkina Faso": "Africa",
"Burma": "Asia",
"Burma (Myanmar)": "Asia",
"Burundi": "Africa",
"Cambodia": "Asia",
"Cameroon": "Africa",
"Canada": "North America",
"Cape Verde": "Africa",
"Cayman Islands": "North America",
"Central African Republic": "Africa",
"Chad": "Africa",
"Chile": "South America",
"China": "Asia",
"Christmas Island": "Oceania",
"Cocos (Keeling) Islands": "Oceania",
"Colombia": "South America",
"Comoros": "Africa",
"Congo": "Africa",
"Congo, Democratic Republic of": "Africa",
"Congo, Democratic Republic of the": "Africa",
"Congo, Republic of the": "Africa",
"Cook Islands": "Oceania",
"Costa Rica": "North America",
"Cote d'Ivoire": "Africa",
"Croatia": "Europe",
"Cuba": "North America",
"Cyprus": "Europe",
"Czech Republic": "Europe",
"Denmark": "Europe",
"Djibouti": "Africa",
"Dominica": "North America",
"Dominican Republic": "North America",
"East Timor": "Asia",
"Ecuador": "South America",
"Egypt": "Africa",
"El Salvador": "North America",
"Equatorial Guinea": "Africa",
"Eritrea": "Africa",
"Estonia": "Europe",
"Ethiopia": "Africa",
"Falkland Islands (Islas Malvinas)": "South America",
"Faroe Islands": "Oceania",
"Fiji": "Oceania",
"Finland": "Europe",
"France": "Europe",
"French Guiana": "South America",
"French Polynesia": "Oceania",
"French Southern and Antarctic Lands": "Oceania",
"Gabon": "Africa",
"Gambia": "Africa",
"Gambia, The": "Africa",
"Georgia": "Europe",
"Germany": "Europe",
"Ghana": "Africa",
"Gibraltar": "Europe",
"Greece": "Europe",
"Greenland": "North America",
"Grenada": "North America",
"Guadeloupe": "North America",
"Guam": "Oceania",
"Guatemala": "North America",
"Guernsey": "Europe",
"Guinea": "Africa",
"Guinea-Bissau": "Africa",
"Guyana": "South America",
"Haiti": "North America",
"Heard Island and McDonald Islands": "Oceania",
"Holy See (Vatican City)": "Europe",
"Honduras": "North America",
"Hong Kong": "Asia",
"Hungary": "Europe",
"Iceland": "Europe",
"India": "Asia",
"Indonesia": "Asia",
"Iran": "Asia",
"Iraq": "Asia",
"Ireland": "Europe",
"Isle of Man": "Europe",
"Israel": "Asia",
"Italy": "Europe",
"Ivory Coast": "Africa",
"Jamaica": "North America",
"Japan": "Asia",
"Jersey": "Europe",
"Jordan": "Asia",
"Kazakhstan": "Asia",
"Kenya": "Africa",
"Kiribati": "Oceania",
"Korea, North": "Asia",
"Korea, South": "Asia",
"Kuwait": "Asia",
"Kyrgyzstan": "Asia",
"Laos": "Asia",
"Latvia": "Europe",
"Lebanon": "Asia",
"Lesotho": "Africa",
"Liberia": "Africa",
"Libya": "Africa",
"Liechtenstein": "Europe",
"Lithuania": "Europe",
"Luxembourg": "Europe",
"Macau": "Asia",
"Macedonia": "Europe",
"Madagascar": "Africa",
"Malawi": "Africa",
"Malaysia": "Asia",
"Maldives": "Asia",
"Mali": "Africa",
"Malta": "Europe",
"Marshall Islands": "Oceania",
"Martinique": "North America",
"Mauritania": "Africa",
"Mauritius": "Africa",
"Mayotte": "Africa",
"Mexico": "North America",
"Micronesia": "Oceania",
"Micronesia, Federated States of": "Oceania",
"Moldova": "Europe",
"Monaco": "Europe",
"Mongolia": "Asia",
"Montenegro": "Europe",
"Montserrat": "North America",
"Morocco": "Africa",
"Mozambique": "Africa",
"Namibia": "Africa",
"Nauru": "Oceania",
"Nepal": "Asia",
"Netherlands": "Europe",
"Netherlands Antilles": "North America",
"New Caledonia": "Oceania",
"New Zealand": "Oceania",
"Nicaragua": "North America",
"Niger": "Africa",
"Nigeria": "Africa",
"Niue": "Oceania",
"Norfolk Island": "Oceania",
"Northern Mariana Islands": "Oceania",
"Norway": "Europe",
"Oman": "Asia",
"Pakistan": "Asia",
"Palau": "Oceania",
"Palestine": "Asia",
"Panama": "North America",
"Papua New Guinea": "Oceania",
"Paraguay": "South America",
"Peru": "South America",
"Philippines": "Asia",
"Pitcairn Islands": "Asia",
"Poland": "Europe",
"Portugal": "Europe",
"Puerto Rico": "North America",
"Qatar": "Asia",
"Reunion": "Africa",
"Romania": "Europe",
"Russia": "Asia",
"Russian Federation": "Asia",
"Rwanda": "Africa",
"Saint Barthelemy": "North America",
"Saint Helena": "Africa",
"Saint Kitts and Nevis": "North America",
"Saint Lucia": "North America",
"Saint Martin": "North America",
"Saint Pierre and Miquelon": "North America",
"Saint Vincent and the Grenadines": "North America",
"Samoa": "Oceania",
"San Marino": "Europe",
"Sao Tome and Principe": "Africa",
"Saudi Arabia": "Asia",
"Senegal": "Africa",
"Serbia": "Europe",
"Seychelles": "Africa",
"Sierra Leone": "Africa",
"Singapore": "Asia",
"Slovakia": "Europe",
"Slovenia": "Europe",
"Solomon Islands": "Oceania",
"Somalia": "Africa",
"South Africa": "Africa",
"South Georgia South Sandwich Islands": "South America",
"South Sudan": "Africa",
"Spain": "Europe",
"Sri Lanka": "Asia",
"Sudan": "Africa",
"Suriname": "South America",
"Svalbard": "Europe",
"Swaziland": "Africa",
"Sweden": "Europe",
"Switzerland": "Europe",
"Syria": "Asia",
"Taiwan": "Asia",
"Tajikistan": "Asia",
"Tanzania": "Africa",
"Thailand": "Asia",
"Timor-Leste": "Asia",
"Togo": "Africa",
"Tokelau": "Oceania",
"Tonga": "Oceania",
"Trinidad and Tobago": "North America",
"Tunisia": "Africa",
"Turkey": "Asia",
"Turkmenistan": "Asia",
"Turks and Caicos Islands": "North America",
"Tuvalu": "Oceania",
"Uganda": "Africa",
"Ukraine": "Europe",
"United Arab Emirates": "Asia",
"United Kingdom": "Europe",
"United States": "North America",
"Uruguay": "South America",
"Uzbekistan": "Asia",
"Vanuatu": "Oceania",
"Vatican City": "Europe",
"Venezuela": "South America",
"Vietnam": "Asia",
"Virgin Islands": "North America",
"Wallis and Futuna": "Oceania",
"Western Sahara": "Africa",
"Yemen": "Asia",
"Zambia": "Africa",
"Zimbabwe": "Africa"
}
### Africa
Algeria
Angola
Benin
Botswana
Burkina
Burundi
Cameroon
Cape Verde
Central African Republic
Chad
Comoros
Congo
Congo, Democratic Republic of
Djibouti
Egypt
Equatorial Guinea
Eritrea
Ethiopia
Gabon
Gambia
Ghana
Guinea
Guinea-Bissau
Ivory Coast
Kenya
Lesotho
Liberia
Libya
Madagascar
Malawi
Mali
Mauritania
Mauritius
Morocco
Mozambique
Namibia
Niger
Nigeria
Rwanda
Sao Tome and Principe
Senegal
Seychelles
Sierra Leone
Somalia
South Africa
South Sudan
Sudan
Swaziland
Tanzania
Togo
Tunisia
Uganda
Zambia
Zimbabwe
### Asia
Afghanistan
Bahrain
Bangladesh
Bhutan
Brunei
Burma (Myanmar)
Cambodia
China
East Timor
India
Indonesia
Iran
Iraq
Israel
Japan
Jordan
Kazakhstan
Korea, North
Korea, South
Kuwait
Kyrgyzstan
Laos
Lebanon
Malaysia
Maldives
Mongolia
Nepal
Oman
Pakistan
Philippines
Qatar
Russian Federation
Saudi Arabia
Singapore
Sri Lanka
Syria
Tajikistan
Thailand
Turkey
Turkmenistan
United Arab Emirates
Uzbekistan
Vietnam
Yemen
### Europe
Albania
Andorra
Armenia
Austria
Azerbaijan
Belarus
Belgium
Bosnia and Herzegovina
Bulgaria
Croatia
Cyprus
Czech Republic
Denmark
Estonia
Finland
France
Georgia
Germany
Greece
Hungary
Iceland
Ireland
Italy
Latvia
Liechtenstein
Lithuania
Luxembourg
Macedonia
Malta
Moldova
Monaco
Montenegro
Netherlands
Norway
Poland
Portugal
Romania
San Marino
Serbia
Slovakia
Slovenia
Spain
Sweden
Switzerland
Ukraine
United Kingdom
Vatican City
### North America
Antigua and Barbuda
Bahamas
Barbados
Belize
Canada
Costa Rica
Cuba
Dominica
Dominican Republic
El Salvador
Grenada
Guatemala
Haiti
Honduras
Jamaica
Mexico
Nicaragua
Panama
Saint Kitts and Nevis
Saint Lucia
Saint Vincent and the Grenadines
Trinidad and Tobago
United States
### Oceania
Australia
Fiji
Kiribati
Marshall Islands
Micronesia
Nauru
New Zealand
Palau
Papua New Guinea
Samoa
Solomon Islands
Tonga
Tuvalu
Vanuatu
### South America
Argentina
Bolivia
Brazil
Chile
Colombia
Ecuador
Guyana
Paraguay
Peru
Suriname
Uruguay
Venezuela
North America ??? Bahamas, The
North America ??? Bermuda
South America ??? Bouvet Island
Asia ??? British Indian Ocean Territory
North America ??? British Virgin Islands
Asia ??? Burma
North America ??? Cayman Islands
Asia ??? Taiwan
Oceania ??? Christmas Island
Oceania ??? Cocos (Keeling) Islands
Africa ??? Mayotte
Africa ??? Congo, Republic of the
Africa ??? Congo, Democratic Republic of the
Oceania ??? Cook Islands
Oceania ??? Faroe Islands
South America ??? Falkland Islands (Islas Malvinas)
South America ??? South Georgia South Sandwich Islands
Europe ??? Aland Islands
South America ??? French Guiana
Oceania ??? French Polynesia
Oceania ??? French Southern and Antarctic Lands
Africa ??? Gambia, The
Asia ??? Palestine
Europe ??? Gibraltar
North America ??? Greenland
North America ??? Guadeloupe
Oceania ??? Guam
Oceania ??? Heard Island and McDonald Islands
Europe ??? Holy See (Vatican City)
Asia ??? Hong Kong
Africa ??? Cote d'Ivoire
Asia ??? Macau
North America ??? Martinique
North America ??? Montserrat
North America ??? Netherlands Antilles
North America ??? Aruba
Oceania ??? New Caledonia
Oceania ??? Niue
Oceania ??? Norfolk Island
Oceania ??? Northern Mariana Islands
Oceania ??? Micronesia, Federated States of
Asia ??? Pitcairn Islands
Asia ??? Timor-Leste
North America ??? Puerto Rico
Africa ??? Reunion
Asia ??? Russia
North America ??? Saint Barthelemy
Africa ??? Saint Helena
North America ??? Anguilla
North America ??? Saint Martin
North America ??? Saint Pierre and Miquelon
Africa ??? Western Sahara
Europe ??? Svalbard
Oceania ??? Tokelau
North America ??? Turks and Caicos Islands
Europe ??? Guernsey
Europe ??? Jersey
Europe ??? Isle of Man
North America ??? Virgin Islands
Africa ??? Burkina Faso
Oceania ??? Wallis and Futuna
function findCountry (name) { return countries.features.filter(function (c) { return c.properties.name.toLowerCase() === name.toLowerCase(); })[0] }
var mapping = lines.reduce(function (grouped, line) {
line = line.trim();
var match;
if ((match = /^###\s([\w\s]+)$/.exec(line))) {
state = match[1];
console.log('Entering ' + state);
}
else {
grouped[line] = state;
console.log('%s is in %s', line, state);
}
return grouped;
}, {});
map.features.forEach(function (f) {
if (!f.properties || !f.properties.name) {
console.log(f, 'No name!')
}
var name = f.properties.name
if (!sorted[name]) {
console.log(' ??? %s', name);
}
else {
f.properties.continent = sorted[name];
}
});
var missing = fs.readFileSync('./missing-continents.txt', 'utf-8')
.split('\n')
.reduce(function (all, line) {
var parts = line.split(' ??? ');
all[parts[1]] = parts[0];
return all;
}, {});
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment