update geo tools

This commit is contained in:
rolux 2011-11-30 15:28:01 +01:00
parent b14604bc14
commit 1b2a7a0eed
3 changed files with 265 additions and 91 deletions

View file

@ -1,16 +1,27 @@
/*
319 countries
350 countries
-- sovereign, dependent and disputed countries according to
http://en.wikipedia.org/wiki/List_of_sovereign_states
-- entities with country codes, according to
http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
-- dissolved countries, according to
http://en.wikipedia.org/wiki/ISO_3166-3 and http://www.imdb.com/country/
current, independent, dependent, disputed: 285, 202, 77, 6
dissolved, independent, dependent, disputed: 34, 22, 11, 1
current, independent, dependent, disputed: 286, 197, 79, 9
dissolved, independent, dependent, disputed: 64, 28, 22, 13
alias: 2
*/
// FIXME: still missing: Cabinda, ...
{
"alias": ["FXFR", "UK"],
"code": {
// http://en.wikipedia.org/wiki/ISO_3166-2:AE
"Abu Dhabi": "AE-AZ",
"Ajman": "AE-AJ",
"Dubai": "AE-DU",
"Fujairah": "AE-FU",
"Ras al-Khaimah": "AE-RK",
"Sharjah": "AE-SH",
"Umm al-Quwain": "AE-UQ",
// http://en.wikipedia.org/wiki/ISO_3166-2:AU
"Ashmore and Cartier Islands": "AU-AC", // AQ
"Coral Sea Islands": "AU-CS", // AQ
@ -23,6 +34,7 @@
"England": "GB-ENG",
"Northern Ireland": "GB-NIR",
"Scotland": "GB-SCT",
"Sealand": "GB-SL", // none
"Wales": "GB-WLS",
// http://en.wikipedia.org/wiki/ISO_3166-2:GE
"Abkhazia": "GE-AB",
@ -33,20 +45,49 @@
"Sark": "GG-SA", // none
// http://en.wikipedia.org/wiki/ISO_3166-2:IN
"Jammu and Kashmir": "IN-JK",
// http://en.wikipedia.org/wiki/ISO_3166-2:KM
"Anjouan": "KM-A",
"Mohéli": "KM-M",
// http://en.wikipedia.org/wiki/ISO_3166-2:MD
"Transnistria": "MD-SN",
// http://en.wikipedia.org/wiki/ISO_3166-2:NG
"Biafra": "NG-BI", // none
// http://en.wikipedia.org/wiki/ISO_3166-2:NO
"Peter I Island": "NO-PI", // AQ
// http://en.wikipedia.org/wiki/ISO_3166-2:NZ
// http://en.wikipedia.org/wiki/ISO_3166-2:PG
"Bougainville": "PG-NSA",
// http://en.wikipedia.org/wiki/ISO_3166-2:PK
"Azad Kashmir": "PK-JK",
"Gilgit-Baltistan": "PK-NA",
// http://en.wikipedia.org/wiki/ISO_3166-2:RU
"Chechnia": "RU-CE",
// http://en.wikipedia.org/wiki/ISO_3166-2:SO
"Somaliland": "SO-SO", // multiple
// http://en.wikipedia.org/wiki/ISO_3166-2:UG
"Rwenzururu": "UG-RW", // unknown
// http://en.wikipedia.org/wiki/ISO_3166-2:ZA
"Bophuthatswana": "ZA-BO", // none
"Ciskei": "ZA-CI", // none
"Transkei": "ZA-TR", // none
"Venda": "ZA-VE", // none
// http://en.wikipedia.org/wiki/List_of_sovereign_states_in_the_1970s
"South Vietnam": "VNVN",
"British Honduras": "GBBZ",
"Ceylon": "LKLK",
"Kampuchea": "KAKH",
"Khmer Republic": "KHKA",
"North Yemen": "YEYE",
"Rhodesia": "RHZW-RH",
"Saint Christopher-Nevis-Anguilla": "GBKN",
"South Vietnam": "VNVN",
"Tanna": "NHVU-TN",
"Trucial States": "GBAE",
"Ukrainian Soviet Socialist Republic": "UAUA",
"United Arab Republic": "EGEG",
"West Germany": "DEDE",
"Zimbabwe Rhodesia": "RHZW-ZR",
// http://en.wikipedia.org/wiki/List_of_sovereign_states_in_the_1980s
"Tafea": "NHVU-TF",
"Vemerana": "NHVU-VE",
// http://en.wikipedia.org/wiki/Territorial_claims_in_Antarctica
"Adélie Land": "FR-AQ",
"Argentine Antarctica": "AR-AQ",
@ -63,11 +104,12 @@
"continents": {
"Africa": {
"Eastern Africa": [
"Burundi", "Comoros", "Djibouti", "Eritrea", "Ethiopia",
"French Afar and Issas", "Kenya", "Madagascar", "Malawi", "Mauritius",
"Mayotte", "Mozambique", "Réunion", "Rhodesia", "Rwanda",
"Seychelles", "Somalia", "Somaliland", "Tanzania", "Uganda",
"Zambia", "Zimbabwe"
"Anjouan", "Burundi", "Comoros", "Djibouti", "Eritrea",
"Ethiopia", "French Afar and Issas", "Kenya", "Madagascar", "Malawi",
"Mauritius", "Mayotte", "Mohéli", "Mozambique", "Réunion", "Rhodesia",
"Rwanda", "Rwenzururu", "Seychelles", "Somalia", "Somaliland",
"Southern Rhodesia", "Tanzania", "Uganda", "Zambia", "Zimbabwe",
"Zimbabwe Rhodesia"
],
"Middle Africa": [
"Angola", "Cameroon", "Central African Republic", "Chad", "Democratic Republic of the Congo",
@ -75,17 +117,19 @@
],
"Northern Africa": [
"Algeria", "Canary Islands", "Ceuta and Melilla", "Egypt", "Libya",
"Morocco", "Sahrawi", "South Sudan", "Sudan", "Tunisia"
"Morocco", "Sahrawi", "South Sudan", "Sudan", "Tunisia",
"United Arab Republic"
],
"Southern Africa": [
"Botswana", "Lesotho", "Namibia", "South Africa", "Swaziland"
"Bophuthatswana", "Botswana", "Ciskei", "Lesotho", "Namibia",
"South Africa", "Swaziland", "Transkei", "Venda"
],
"Western Africa": [
"Ascension", "Benin", "Burkina Faso", "Cape Verde", "Côte d'Ivoire",
"Dahomey", "Gambia", "Ghana", "Guinea", "Guinea-Bissau",
"Liberia", "Mali", "Mauritania", "Niger", "Nigeria",
"Saint Helena", "Senegal", "Sierra Leone", "Togo", "Tristan da Cunha",
"Upper Volta"
"Ascension", "Benin", "Biafra", "Burkina Faso", "Cape Verde",
"Côte d'Ivoire", "Dahomey", "Gambia", "Ghana", "Guinea",
"Guinea-Bissau", "Liberia", "Mali", "Mauritania", "Niger",
"Nigeria", "Saint Helena, Ascension and Tristan da Cunha", "Senegal", "Sierra Leone", "Togo",
"Tristan da Cunha", "Upper Volta"
]
},
"Antarctica": {
@ -109,36 +153,39 @@
],
"South-Eastern Asia": [
"Brunei", "Burma", "Cambodia", "Christmas Island", "Cocos Islands",
"East Timor", "Indonesia", "Laos", "Malaysia", "Myanmar",
"North Vietnam", "Philippines", "Siam", "Singapore", "South Vietnam",
"Thailand", "Timor-Leste", "Vietnam"
"East Timor", "Indonesia", "Kampuchea", "Khmer Republic", "Laos",
"Malaysia", "Myanmar", "North Vietnam", "Philippines", "Siam",
"Singapore", "South Vietnam", "Thailand", "Timor-Leste", "Vietnam"
],
"Southern Asia": [
"Afghanistan", "Azad Kashmir", "Bangladesh", "Bhutan", "British Indian Ocean Territory",
"Diego Garcia", "Gilgit-Baltistan", "India", "Iran", "Jammu and Kashmir",
"Maldives", "Nepal", "Pakistan", "Sikkim", "Sri Lanka"
"Ceylon", "Diego Garcia", "Gilgit-Baltistan", "India", "Iran",
"Jammu and Kashmir", "Maldives", "Nepal", "Pakistan", "Sikkim",
"Sri Lanka"
],
"Western Asia": [
"Abkhazia", "Akrotiri and Dhekelia", "Armenia", "Azerbaijan", "Bahrain",
"Cyprus", "Georgia", "Iraq", "Israel", "Jordan",
"Kuwait", "Lebanon", "Neutral Zone", "Nagorno-Karabakh", "North Yemen",
"Northern Cyprus", "Oman", "Palestine", "Qatar", "Saudi Arabia",
"South Ossetia", "South Yemen", "Syria", "Turkey", "United Arab Emirates",
"Yemen"
"Abkhazia", "Abu Dhabi", "Akrotiri and Dhekelia", "Ajman", "Armenia",
"Azerbaijan", "Bahrain", "Cyprus", "Dubai", "Fujairah",
"Georgia", "Iraq", "Israel", "Jordan", "Kuwait",
"Lebanon", "Neutral Zone", "Nagorno-Karabakh", "North Yemen", "Northern Cyprus",
"Oman", "Palestine", "Qatar", "Ras al-Khaimah", "Saudi Arabia",
"Sharjah", "South Ossetia", "South Yemen", "Syria", "Trucial States",
"Turkey", "Umm al-Quwain", "United Arab Emirates", "Yemen"
]
},
"Europe": {
"Eastern Europe": [
"Belarus", "Bulgaria", "Byelorussian Soviet Socialist Republic", "Czech Republic", "Czechoslovakia",
"Hungary", "Moldova", "Poland", "Romania", "Russia",
"Slovakia", "Soviet Union", "Transnistria", "Ukraine"
"Belarus", "Bulgaria", "Byelorussian Soviet Socialist Republic", "Chechnia", "Czech Republic",
"Czechoslovakia", "Hungary", "Moldova", "Poland", "Romania",
"Russia", "Slovakia", "Soviet Union", "Transnistria", "Ukraine",
"Ukrainian Soviet Socialist Republic"
],
"Northern Europe": [
"Åland Islands", "Alderney", "Denmark", "England", "Estonia",
"Faroe Islands", "Finland", "Guernsey", "Herm", "Iceland",
"Ireland", "Isle of Man", "Jersey", "Latvia", "Lithuania",
"Northern Ireland", "Norway", "Sark", "Scotland", "Svalbard and Jan Mayen",
"Sweden", "United Kingdom", "Wales"
"Northern Ireland", "Norway", "Sark", "Scotland", "Sealand",
"Svalbard and Jan Mayen", "Sweden", "United Kingdom", "Wales"
],
"Southern Europe": [
"Albania", "Andorra", "Bosnia and Herzegovina", "Croatia", "Gibraltar",
@ -162,8 +209,8 @@
"Ashmore and Cartier Islands", "Australia", "New Zealand", "Coral Sea Islands", "Norfolk Island"
],
"Melanesia": [
"Fiji", "New Caledonia", "New Hebrides", "Papua New Guinea", "Solomon Islands",
"Vanuatu"
"Bougainville", "Fiji", "New Caledonia", "New Hebrides", "Papua New Guinea",
"Solomon Islands", "Tafea", "Tanna", "Vanuatu", "Vemerana"
],
"Micronesia": [
// Gilbert and Ellice Islands split into Kiribati (Micronesia) and Tuvalu (Polynesia)
@ -179,16 +226,17 @@
},
"South America": {
"Central America": [
"Belize", "Clipperton Island", "Costa Rica", "El Salvador", "Guatemala",
"Honduras", "Mexico", "Nicaragua", "Panama", "Panama Canal Zone"
"Belize", "British Honduras", "Clipperton Island", "Costa Rica", "El Salvador",
"Guatemala", "Honduras", "Mexico", "Nicaragua", "Panama",
"Panama Canal Zone"
],
"Caribbean": [
"Anguilla", "Antigua and Barbuda", "Aruba", "Bahamas", "Barbados",
"Bonaire, Sint Eustatius and Saba", "British Virgin Islands", "Cayman Islands", "Cuba", "Curaçao",
"Dominica", "Dominican Republic", "Grenada", "Guadeloupe", "Haiti",
"Jamaica", "Martinique", "Montserrat", "Netherlands Antilles", "Puerto Rico",
"Saint Barthélemy", "Saint Kitts and Nevis", "Saint Lucia", "Saint Martin", "Saint Vincent and the Grenadines",
"Sint Maarten", "Trinidad and Tobago", "Turks and Caicos Islands", "United States Virgin Islands"
"Saint Barthélemy", "Saint Christopher-Nevis-Anguilla", "Saint Kitts and Nevis", "Saint Lucia", "Saint Martin",
"Saint Vincent and the Grenadines", "Sint Maarten", "Trinidad and Tobago", "Turks and Caicos Islands", "United States Virgin Islands"
],
"Southern America": [
"Argentina", "Bolivia", "Brazil", "Chile", "Colombia",
@ -217,10 +265,10 @@
"Chile": ["Chilean Antarctic Territory"],
"China": ["Hong Kong", "Macau"],
"Denmark": ["Faroe Islands", "Greenland"],
"Finland": ["Åland"],
"Finland": ["Åland Islands"],
"France": [
"Adélie Land", "Clipperton Island", "French Afar and Issas", "French Guiana", "French Polynesia",
"French Southern and Antarctic Lands", "French Southern Lands", "Guadeloupe", "Martinique", "Mayotte",
"French Southern and Antarctic Territories", "French Southern Territories", "Guadeloupe", "Martinique", "Mayotte",
"New Caledonia", "Réunion", "Saint Barthélemy", "Saint Martin", "Saint Pierre and Miquelon",
"Wallis and Futuna"
],
@ -235,30 +283,40 @@
"Pakistan": ["Azad Kashmir", "Gilgit-Baltistan"],
"Spain": ["Canary Islands", "Ceuta and Melilla"],
"South Africa": ["Bophuthatswana", "Ciskei", "Transkei", "Venda"],
"Soviet Union": ["Byelorussian Soviet Socialist Republic"], // fixme: what about ukraine?
"Soviet Union": ["Byelorussian Soviet Socialist Republic", "Ukrainian Soviet Socialist Republic"],
"United Kingdom": [
"Akrotiri and Dhekelia", "Anguilla", "Ascension", "Bermuda", "British Antarctic Territory",
"British Indian Ocean Territory", "British Virgin Islands", "Cayman Islands", "Diego Garcia", "England",
"Falkland Islands", "Gibraltar", "Gilbert and Ellice Islands", "Guernsey", "Isle of Man",
"Jersey", "Montserrat", "Northern Ireland", "Pitcairn Islands", "Saint Helena",
"Scotland", "South Georgia and the South Sandwich Islands", "Tristan da Cunha", "Turks and Caicos Islands", "Wales"
"British Honduras", "British Indian Ocean Territory", "British Virgin Islands", "Cayman Islands", "Diego Garcia",
"England", "Falkland Islands", "Gibraltar", "Gilbert and Ellice Islands", "Guernsey",
"Isle of Man", "Jersey", "Montserrat", "Northern Ireland", "Pitcairn Islands",
"Saint Christopher-Nevis-Anguilla", "Saint Helena, Ascension and Tristan da Cunha", "Scotland", "South Georgia and the South Sandwich Islands", "Southern Rhodesia",
"Tristan da Cunha", "Trucial States", "Turks and Caicos Islands", "Wales"
],
"United Kingdom, United States": ["Canton and Enderbury Islands"],
"United States": [
"American Samoa", "Guam", "Northern Mariana Islands", "Johnston Atoll", "Midway Islands",
"American Samoa", "Guam", "Northern Mariana Islands", "Johnston Island", "Midway Islands",
"Pacific Islands", "Panama Canal Zone", "Puerto Rico", "United States Minor Outlying Islands", "United States Miscellaneous Pacific Islands",
"United States Virgin Islands", "Wake Island"
]
},
"disputes": {
"Azerbaijan": ["Nagorno-Karabakh"],
"Comoros": ["Anjouan"],
"Comoros": ["Anjouan", "Mohéli"],
"Cyprus": ["Northern Cyprus"],
"Georgia": ["Abkhazia", "South Ossetia"],
"Indonesia": ["East Timor"],
"Iraq, Saudi Arabia": ["Neutral Zone"],
"Moldova": ["Transnistria"],
"Morocco": ["Sahrawi"],
"New Hebrides": ["Tafea", "Tanna", "Vemerana"],
"Nigeria": ["Biafra"],
"Somalia": ["Somaliland"]
"Papua New Guinea": ["Bougainville"],
"Russia": ["Chechnia"],
"Serbia": ["Kosovo"],
"Somalia": ["Somaliland"],
"Southern Rhodesia": ["Rhodesia", "Zimbabwe Rhodesia"],
"Uganda": ["Rwenzururu"],
"United Kingdom": ["Sealand"]
},
"dissolved": {
// joined: joined an existing country (or split between existing countries)
@ -267,20 +325,24 @@
// split: split into new countries
"Korea": {"country": "Japan", "date": "1910-08-22", "dissolved": "joined"},
"Siam": {"country": "Thailand", "date": "1939-06-23", "dissolved": "renamed"},
// "Biafra": {"country": "Nigeria", "date": "1970-01-15", "dissolved": "joined"},
// "Trucial States": {"country": [
// "Abu Dhabi", "Ajman", "Dubai", "Fujairah", "Ras al-Khaimah",
// "Sharjah", "Umm al-Quwain"
// ], "date": "1971-12-01", "dissolved": "split"},
// "Abu Dhabi": {"country": "United Arab Emirates", "date": "1971-12-02", "dissolved": "merged"},
// "Ajman": {"country": "United Arab Emirates", "date": "1971-12-02", "dissolved": "merged"},
// "Dubai": {"country": "United Arab Emirates", "date": "1971-12-02", "dissolved": "merged"},
// "Fujairah": {"country": "United Arab Emirates", "date": "1971-12-02", "dissolved": "merged"},
// "Sharjah": {"country": "United Arab Emirates", "date": "1971-12-02", "dissolved": "merged"},
// "Umm al-Quwain": {"country": "United Arab Emirates", "date": "1971-12-02", "dissolved": "merged"},
// "Ras al-Khaimah": {"country": "United Arab Emirates", "date": "1972-02-11", "dissolved": "joined"},
"Biafra": {"country": "Nigeria", "date": "1970-01-15", "dissolved": "joined"},
"United Arab Republic": {"country": "Egypt", "date": "1971-09-01", "dissolved": "renamed"},
"Trucial States": {"country": [
"Abu Dhabi", "Ajman", "Dubai", "Fujairah", "Ras al-Khaimah",
"Sharjah", "Umm al-Quwain"
], "date": "1971-12-01", "dissolved": "split"},
"Abu Dhabi": {"country": "United Arab Emirates", "date": "1971-12-02", "dissolved": "merged"},
"Ajman": {"country": "United Arab Emirates", "date": "1971-12-02", "dissolved": "merged"},
"Dubai": {"country": "United Arab Emirates", "date": "1971-12-02", "dissolved": "merged"},
"Fujairah": {"country": "United Arab Emirates", "date": "1971-12-02", "dissolved": "merged"},
"Sharjah": {"country": "United Arab Emirates", "date": "1971-12-02", "dissolved": "merged"},
"Umm al-Quwain": {"country": "United Arab Emirates", "date": "1971-12-02", "dissolved": "merged"},
"Ras al-Khaimah": {"country": "United Arab Emirates", "date": "1972-02-11", "dissolved": "joined"},
"Ceylon": {"country": "Sri Lanka", "date": "1972-05-22", "dissolved": "renamed"},
"British Honduras": {"country": "Belize", "date": "1973-06-01", "dissolved": "renamed"},
"Tanna": {"country": "New Hebrides", "date": "1974-06-29", "dissolved": "joined"},
"Khmer Republic": {"country": "Kampuchea", "date": "1975-04-17", "dissolved": "renamed"},
"Sikkim": {"country": "India", "date": "1975-05-16", "dissolved": "joined"},
// "Dutch Guiana": {"country": "Suriname", "date": "1975-11-25", "dissolved": "renamed"},
"Dahomey": {"country": "Benin", "date": "1975-11-30", "dissolved": "renamed"},
"North Vietnam": {"country": "Vietnam", "date": "1976-07-02", "dissolved": "merged"},
"South Vietnam": {"country": "Vietnam", "date": "1976-07-02", "dissolved": "merged"},
@ -288,13 +350,22 @@
"French Southern and Antarctic Territories": {"country": [
"Adélie Land', 'French Southern Territories"
], "date": "1979", "dissolved": "split"},
"Rhodesia": {"country": "Zimbabwe Rhodesia", "date": "1979-06-01", "dissolved": "renamed"},
"Canton and Enderbury Islands": {"country": "Kiribati", "date": "1979-07-12", "dissolved": "merged"},
// actually, Tuvalu became independent 1978-10-01
"Gilbert and Ellice Islands": {"country": [
"Kiribati", "Tuvalu"
], "date": "1979-07-12", "dissolved": "split"},
"Panama Canal Zone": {"country": "Panama", "date": "1979-10-01", "dissolved": "joined"},
"Rhodesia": {"country": "Zimbabwe", "date": "1980-04-18", "dissolved": "renamed"},
"Zimbabwe Rhodesia": {"country": "Southern Rhodesia", "date": "1979-06-01", "dissolved": "renamed"},
"Southern Rhodesia": {"country": "Zimbabwe", "date": "1980-04-18", "dissolved": "renamed"},
"Tafea": {"country": "New Hebrides", "date": "1980-05-26", "dissolved": "joined"},
"Vemerana": {"country": "New Hebrides", "date": "1980-07-24", "dissolved": "joined"},
"New Hebrides": {"country": "Vanuatu", "date": "1980-07-30", "dissolved": "renamed"},
"Rwenzururu": {"country": "Uganda", "date": "1982-08-13", "dissolved": "joined"},
"Saint Christopher-Nevis-Anguilla": {"country": [
"Anguilla", "Saint Kitts and Nevis"
], "date": "1983-09-19", "dissolved": "split"},
"Upper Volta": {"country": "Burkina Faso", "date": "1984-08-04", "dissolved": "renamed"},
"Johnston Island": {"country": "United States Minor Outlying Islands", "date": "1986", "dissolved": "merged"},
"Midway Islands": {"country": "United States Minor Outlying Islands", "date": "1986", "dissolved": "merged"},
@ -303,7 +374,8 @@
"Pacific Islands": {"country": [
"Marshall Islands", "Micronesia", "Northern Mariana Islands", "Palau"
], "date": "1986", "dissolved": "split"},
"Burma": {"country": "Myanmar", "date": "1989", "dissolved": "renamed"},
"Kampuchea": {"country": "Cambodia", "date": "1989-05-01", "dissolved": "renamed"},
"Burma": {"country": "Myanmar", "date": "1989-06-18", "dissolved": "renamed"},
"North Yemen": {"country": "Yemen", "date": "1990-05-22", "dissolved": "merged"},
"South Yemen": {"country": "Yemen", "date": "1990-05-22", "dissolved": "merged"},
"East Germany": {"country": "Germany", "date": "1990-10-03", "dissolved": "merged"},
@ -313,21 +385,26 @@
], "date": "1991", "dissolved": "joined"},
// The Byelorussian Soviet Socialist Republic, like the Ukrainian SSR,
// had its own ISO 3361-1 code, being a member of the United Nations
"Ukrainian Soviet Socialist Republic": {"country": "Ukraine", "date": "1991-08-24", "dissolved": "renamed"},
"Byelorussian Soviet Socialist Republic": {"country": "Belarus", "date": "1991-08-25", "dissolved": "renamed"},
"Soviet Union": {"country": [
"Armenia", "Azerbaijan", "Belarus", "Estonia", "Georgia",
"Kazakhstan", "Kyrgyzstan", "Latvia", "Lithuania", "Moldova",
"Russia", "Tajikistan", "Turkmenistan", "Ukraine", "Uzbekistan"
], "date": "1991-12-21", "dissolved": "split"},
"Armenia", "Azerbaijan", "Estonia", "Georgia", "Kazakhstan",
"Kyrgyzstan", "Latvia", "Lithuania", "Moldova", "Russia",
"Tajikistan", "Turkmenistan", "Uzbekistan"
], "date": "1991-12-25", "dissolved": "split"},
"Czechoslovakia": {"country": [
"Czech Republic", "Slovakia"
], "date": "1993-01-01", "dissolved": "split"},
// "Bophuthatswana": {"country": "South Africa", "date": "1994-04-27", "dissolved": "joined"},
// "Ciskei": {"country": "South Africa", "date": "1994-04-27", "dissolved": "joined"},
// "Transkei": {"country": "South Africa", "date": "1994-04-27", "dissolved": "joined"},
// "Venda": {"country": "South Africa", "date": "1994-04-27", "dissolved": "joined"},
"Bophuthatswana": {"country": "South Africa", "date": "1994-04-27", "dissolved": "joined"},
"Ciskei": {"country": "South Africa", "date": "1994-04-27", "dissolved": "joined"},
"Transkei": {"country": "South Africa", "date": "1994-04-27", "dissolved": "joined"},
"Venda": {"country": "South Africa", "date": "1994-04-27", "dissolved": "joined"},
"Metropolitan France": {"country": "France", "date": "1997", "dissolved": "merged"},
"Zaire": {"country": "Democratic Republic of the Congo", "date": "1997-05-17", "dissolved": "renamed"},
"Bougainville": {"country": "Papua New Guinea", "date": "1998-12-24", "dissolved": "joined"},
"Chechnia": {"country": "Russia", "date": "2000-02-06", "dissolved": "joined"},
"Anjouan": {"country": "Comoros", "date": "2002-03-10", "dissolved": "joined"},
"Mohéli": {"country": "Comoros", "date": "2002-03-10", "dissolved": "joined"},
"East Timor": {"country": "Timor-Leste", "date": "2002-05-20", "dissolved": "renamed"},
"Yugoslavia": {"country": "Serbia and Montenegro", "date": "2003-02-04", "dissolved": "renamed"},
"Serbia and Montenegro": {"country": [
@ -367,41 +444,64 @@
// renamed
"Burma": "Flag of Myanmar (1974-2010)",
"Siam": "State Flag of Thailand (1916)",
// ...
"Mohéli": "Flag of Mohéli",
"Tafea": "Tafea Flag",
"Tanna": "Bandera Tanna Vanuatu",
// identical
"Ajman": "Flag of Dubai",
"Ceylon": "Flag of Sri Lanka",
"Fujairah": "Flag of the United Arab Emirates",
"United Arab Republic": "Flag of Syria",
// regexp fails
"Panama Canal Zone": "Panama Canal Zone Flag.png"
"Panama Canal Zone": "Panama Canal Zone Flag.png",
"Rwenzururu": "Rwenzururu flag.png"
},
"flag_link": [
// these are dependencies that share their flag with another dependency
// and need to get a symlink to the other flag
// these are dependent or dissolved countrie that share their flag
// with another country and need to get a symlink to the other flag
"Adélie Land",
"Ajman",
"Canton and Enderbury Islands",
"Diego Garcia",
"French Southern and Antarctic Territories"
"French Southern and Antarctic Territories",
"Ras al-Khaimah"
],
"geocode": {
// construction of countries unknown to the google maps geocoder
"Abkhazia": ["Abkhazia, Georgia"],
"Abu Dhabi": ["Abu Dhabi Region"],
"Ajman": ["Ajman Region"],
"Akrotiri and Dhekelia": ["Akrotiri, Cyprus", "Dhekelia, Cyprus"],
"Biafra": ["Bayelsa, Nigeria", "Cross River, Nigeria", "Enugu, Nigeria"],
"Bonaire, Sint Eustatius and Saba": ["Bonaire", "Saba", "Sint Eustatius"],
"Bophuthatswana": ["Babelegi, South Africa", "Gaberone, Botswana", "Hotazel, South Africa", "Maseru, Lesotho"], // approximate
"British Honduras": ["Belize"],
"Byelorussian Soviet Socialist Republic": ["Belarus"],
"Canary Islands": ["Ferro, Canary Islands", "Isla Alegranza, Canary Islands"],
"Canton and Enderbury Islands": ["Canton Island", "Enderbury Island"],
"Ceuta and Melilla": ["Ceuta", "Melilla"],
"Ciskei": ["East London, South Africa", "Port Alfred, South Africa", "Queenstown, South Africa"], // approximate
"Czechoslovakia": ["Czech Republic", "Slovakia"],
"East Germany": ["Mecklenburg Vorpommern", "Saxony", "Thuringia"],
"East Timor": ["Timor-Leste"],
"Dahomey": ["Benin"],
"Dubai": ["Dubai Region"],
"European Union": ["Cyprus", "Finland", "Greece", "Portugal"],
"French Afar and Issas": ["Djibouti"],
// see http://en.wikipedia.org/wiki/French_Southern_and_Antarctic_Lands
// and http://en.wikipedia.org/wiki/Scattered_Islands_in_the_Indian_Ocean
"French Southern and Antarctic Territories": ["Adélie Land", "Bassas da India", "Glorioso Islands"],
"French Southern Territories": ["Amsterdam Island", "Bassas da India", "Glorioso Islands", "Kerguelen Island"],
"Fujairah": ["Fujairah Region"],
"Georgia": ["Georgia, Asia"],
// see http://en.wikipedia.org/wiki/Gilbert_Islands
"Gilbert and Ellice Islands": ["Arorae, Kiribati", "Butaritari, Kiribati", "Makin, Kiribati", "Tuvalu"],
// "Jamaica": ["Clarendon Parish, Jamaica", "St. James Parish, Jamaica", "St. Thomas Parish, Jamaica", "Westmoreland Parish, Jamaica"], // in case results are us-biased
"Jammu and Kashmir": ["Jammu and Kashmir, India"],
"Johnston Island": ["Johnston Atoll"],
"Kampuchea": ["Cambodia"],
"Khmer Republic": ["Cambodia"],
"Korea": ["North Korea", "South Korea"],
"Lebanon": ["Lebanon, Asia"], // in case results are us-biased
"Metropolitan France": ["France"],
@ -413,10 +513,14 @@
"Pacific Islands": ["Marshall Islands", "Micronesia", "Northern Mariana Islands", "Palau"],
// "Palestine": ["71, Israel", "El-arish Rafah, Egypt"],
"Panama Canal Zone": ["Amador, Panama", "Fort Sherman, Panama"],
"Ras al-Khaimah": ["Ras al-Khaimah Region"],
"Rwenzururu": ["Bundibugyo Region, Uganda", "Busongora, Uganda"],
"Sahrawi": ["Western Sahara"],
"Saint Helena": ["Ascension Island", "Longwood, Saint Helena", "Tristan da Cunha"], // in case results are us-biased
"Saint Christopher-Nevis-Anguilla": ["Anguilla", "Saint Kitts and Nevis"],
"Saint Helena, Ascension and Tristan da Cunha": ["Ascension Island", "Longwood, Saint Helena", "Tristan da Cunha"],
"San Marino": ["San Marino, Europe"], // in case results are us-biased
"Serbia and Montenegro": ["Montenegro", "Serbia"],
"Sharjah": ["Sharjah Region"],
"Siam": ["Thailand"],
"Sint Maarten": ["Great Bay, Sint Maarten", "Oyster Pond, Sint Maarten", "Simpson Bay Lagoon, Sint Maarten"],
"South Ossetia": ["Shida Kartli"],
@ -427,11 +531,18 @@
// ],
"South Vietnam": ["Ca Mau Province, Vietnam", "Da Nang Province, Vietnam", "Khanh Hoa Province, Vietnam", "Kien Giang Province, Vietnam"],
"South Yemen": ["Al-Mahrah, Yemen", "Lahij, Yemen"],
"Southern Rhodesia": ["Zimbabwe"],
"Soviet Union": [
"Armenia", "Azerbaijan", "Belarus", "Estonia", "Georgia, Europe",
"Latvia", "Lithuania", "Kazakhstan", "Kyrgyzstan", "Moldova",
"Russia", "Tajikistan", "Turkmenistan", "Ukraine", "Uzbekistan"
],
"Tanna": ["Tanna, Vanuatu"],
"Transkei": ["Matatiele, South Africa", "Port Edward, South Africa", "Queenstown, South Africa"], // approximate
"Trucial States": ["United Arab Emirates"],
"Ukrainian Soviet Socialist Republic": ["Ukraine"],
"Umm al-Quwain": ["Umm al-Quwain Region"],
"United Arab Republic": ["Egypt"],
"United Kingdom": ["England", "Northern Ireland", "Scotland"],
"United States Minor Outlying Islands": [
"Baker Island, UM", "Howland Island", "Jarvis Island", "Johnston Atoll", "Kingman Reef",
@ -442,6 +553,8 @@
"Baker Island, UM", "Howland Island", "Jarvis Island", "Kingman Reef", "Palmyra Atoll"
],
"Upper Volta": ["Burkina Faso"],
"Vemerana": ["Espiritu Santo"],
"Venda": ["Pafuri, Mozambique", "Tzaneen, South Africa"], // approximate
"Wales": ["Wales, United Kingdom"],
"West Germany": ["Schleswig Holstein", "Northrhine Westphalia", "Bavaria, Germany"],
"Yugoslavia": [
@ -477,6 +590,7 @@
"Pitcairn Islands": "Pitcairn",
"Republic of the Congo": "Congo",
"Sahrawi": "Western Sahara",
"Saint Helena, Ascension and Tristan da Cunha": "Saint Helena",
"Saint Martin": "Saint Martin (French part)",
"São Tomé and Príncipe": "Sao Tome and Principe",
// IMDb treats Socialist Yugoslavia (split in 1991) and Post-Socialist
@ -773,7 +887,7 @@
"Tswa": "",
"Tswana": "",
"Tulu": "",
"Tupi": "",
"Tupi": "Brazil",
"Turkish": "Turkey",
"Turkmen": "Turkmenistan",
"Tuvinian": "",
@ -846,15 +960,23 @@
"west": 160,
"north": -60,
"east": -150
},
// see http://en.wikipedia.org/wiki/Sealand
// and http://en.wikipedia.org/wiki/HM_Fort_Roughs
// 51°53'42.6"N 1°28'49.8"E is 51.8951666667,1.4805
// 168 by 88 feet are 51.2064 by 26.8224 meters
// or 0.0007454112 by 0.0003904535 degrees
"Sealand": {
"south": 51.8949714399,
"west": 1.4801272944,
"north": 51.8953618934,
"east": 1.4808727056
}
},
"name": {
// http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
"Ceuta": "Ceuta and Melilla",
"Palestinian territories": "Palestine",
// The long name "Saint Helena, Ascension and Tristan da Cunha" is correct,
// but Ascension and Tristan da Cunha have their own ISO 3166-1 alpha-2 codes.
"Saint Helena, Ascension and Tristan da Cunha": "Saint Helena",
"Western Sahara": "Sahrawi",
// http://en.wikipedia.org/wiki/List_of_sovereign_states
"Kingdom of the Netherlands": "Netherlands",
@ -871,20 +993,26 @@
"Midway Atoll": "Midway Islands",
"Saudi-Iraqi neutral zone": "Neutral Zone",
// shorten
"Autonomous Region of Bougainville": "Bougainville",
"Chechen Republic of Ichkeria": "Chechnia",
"Cocos (Keeling) Islands": "Cocos Islands",
"Collectivity of Saint Martin": "Saint Martin",
"Coral Sea Islands Territory": "Coral Sea Islands",
"Dominion of Ceylon": "Ceylon",
"Federated States of Micronesia": "Micronesia",
"Georgia (country)": "Georgia",
"Korean Empire": "Korea",
"Nagorno-Karabakh Republic": "Nagorno-Karabakh",
"People's Republic of China": "China",
"People's Republic of Kampuchea": "Kampuchea",
"Republic of China": "Taiwan",
"Republic of Dahomey": "Dahomey",
"Republic of Ireland": "Ireland",
"Republic of Kosovo": "Kosovo",
"Republic of Macedonia": "Macedonia",
"Republic of Upper Volta": "Upper Volta",
"Sharjah (emirate)": "Sharjah",
"Tanna (island)": "Tanna",
"The Bahamas": "Bahamas",
"The Gambia": "Gambia",
"Trust Territory of the Pacific Islands": "Pacific Islands",
@ -900,18 +1028,54 @@
"Jammu and Kashmir",
"Peter I Island",
// http://en.wikipedia.org/wiki/List_of_sovereign_states_in_the_1970s
"Abu Dhabi",
"Ajman",
"Biafra",
"Bophuthatswana",
"British Honduras",
"Dominion of Ceylon",
"Dubai",
"Ciskei",
"Fujairah",
"Khmer Republic",
"People's Republic of Kampuchea",
"Ras al-Khaimah",
"Rhodesia",
"Rwenzururu",
"Saint Christopher-Nevis-Anguilla",
"Sharjah (emirate)",
"South Vietnam",
"Tanna (island)",
"Transkei",
"Trucial States",
"Umm al-Quwain",
"United Arab Republic",
"Ukrainian Soviet Socialist Republic",
"Venda",
"West Germany",
"Yemen Arab Republic",
"Zimbabwe Rhodesia",
// http://en.wikipedia.org/wiki/List_of_sovereign_states_in_the_1980s
"Tafea",
"Vemerana",
// http://en.wikipedia.org/wiki/List_of_sovereign_states_in_the_1990s
"Anjouan",
"Autonomous Region of Bougainville",
"Chechen Republic of Ichkeria",
"Mohéli",
// ...
"Sealand",
// http://en.wikipedia.org/wiki/Territorial_claims_in_Antarctica
"Adélie Land",
"Argentine Antarctica",
"Chilean Antarctic Territory",
// http://www.imdb.com/country/
"Korean Empire",
"Siam",
"West Germany"
"Siam"
],
"wikipedia_url": {
// Wrong in http://en.wikipedia.org/wiki/ISO_3166-3
"Rhodesia": "Southern Rhodesia",
// Wrong in http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 (which we parse
// before the list of sovereign states in order to get the country codes).
// There is only one Wikipedia page for East Timor (TPTL) and Timor-Leste (TL)

View file

@ -8,7 +8,11 @@ import sys
import urllib
CACHE = sys.argv[-1] == '-cache'
DATA = ox.jsonc.loads(ox.file.read_file('../jsonc/countries.jsonc'))
try:
DATA = ox.jsonc.loads(ox.file.read_file('../jsonc/countries.jsonc'))
except:
ox.file.write_file('../jsonc/debug.json', ox.js.minify(ox.file.read_file('../jsonc/countries.jsonc')))
sys.exit()
LOGS = {}
def decode_wikipedia_id(id):
@ -50,7 +54,7 @@ def get_countries():
return country['code'] if 'code' in country else u'ZZ ' + country['name']
countries = map(lambda x: parse(x), DATA['wikipedia'])
# ISO 3166-3
html = read_wikipedia_url('ISO 3166-3')
html = read_wikipedia_url('ISO 3166-3').replace('Rhodesia', 'Southern Rhodesia') # FIXME: can this be avoided?
matches = re.compile('<td id="([A-Z]{4})">.*?<a href="/wiki/(.*?)".*?>', re.DOTALL).findall(html)
countries += map(lambda x: parse(x), matches)
# ISO 3166-1 alpha-2
@ -68,6 +72,7 @@ def get_countries():
print year, '-' * 64
for x in map(lambda x: x['name'], filter(lambda x: not exists(x), map(lambda x: parse(x), matches))):
print x
sys.exit()
'''
# Country data
countries = sorted(countries, key=sort)
@ -92,6 +97,9 @@ def get_country_data(country):
match = re.search('"/wiki/\.(\w{2})"', html)
if match:
country['code'] = match.group(1).upper()
# alias
if country['code'] in DATA['alias']:
country['alias'] = True
# continents and regions
for continent, regions in DATA['continents'].iteritems():
for region, countries in regions.iteritems():
@ -255,8 +263,9 @@ if __name__ == '__main__':
LOGS['dissolved independent'] = 0
LOGS['dissolved dependent'] = 0
LOGS['dissolved disputed'] = 0
LOGS['alias'] = 0
for country in countries:
key = ' '.join([
key = 'alias' if 'alias' in country else ' '.join([
'dissolved' if 'dissolved' in country else 'current',
'disputed' if 'disputed' in country else ('dependent' if 'dependency' in country else 'independent')
])

View file

@ -22,7 +22,7 @@ for file in os.listdir(svg_path):
image = image.resize((size, size), Image.ANTIALIAS)
image.save(png_file.replace('/4096/', '/%d/' % size))
if sys.argv[-1] == '-png':
if sys.argv[-1] != '-nopng':
for file in os.listdir('../png/flags/'):
if file[-4:] == '.png':
country = file[:-4]
@ -31,15 +31,16 @@ if sys.argv[-1] == '-png':
image = Image.open(png_file)
# include 4096 to overwrite manually generated image
for size in [4096, 1024, 256, 64, 16]:
image = image.resize((size, size), Image.ANTIALIAS)
if size < 4096:
image = image.resize((size, size), Image.ANTIALIAS)
image.save(png_file.replace('/4096/', '/%d/' % size))
image = Image.new('RGB', (1152,1152))
image = Image.new('RGB', (1216, 1216))
f = open('../json/countries.json')
countries = json.loads(f.read())
f.close()
for i, country in enumerate(countries):
file = png_path.replace('/4096/', '/64/') + country['code'] + '.png'
if os.path.exists(file):
image.paste(Image.open(file), (i % 18 * 64, int(i / 18) * 64))
image.paste(Image.open(file), (i % 19 * 64, int(i / 19) * 64))
image.save('../png/icons.png')