update geo module

This commit is contained in:
rolux 2012-10-19 12:53:09 +02:00
parent 790e0c4500
commit 4da93006fc
6 changed files with 29 additions and 17 deletions

View file

@ -91,11 +91,11 @@ Ox.load.Geo = function(options, callback) {
];
</script>
> Ox.COUNTRIES.length
353
354
> Ox.sum(Ox.test.array)
353
354
> Ox.test.array
[196, 73, 9, 8, 28, 24, 14, 1]
[196, 73, 10, 8, 28, 24, 14, 1]
@*/
Ox.COUNTRIES = data;

View file

@ -1,5 +1,5 @@
/*
353 countries
354 countries
-- sovereign, dependent and disputed countries according to
http://en.wikipedia.org/wiki/List_of_sovereign_states
-- entities with country codes, according to
@ -47,6 +47,8 @@
"Mohéli": "KM-M",
// http://en.wikipedia.org/wiki/ISO_3166-2:MD
"Transnistria": "MD-SN",
// http://en.wikipedia.org/wiki/ISO_3166-2:ML
"Azawad": "ML-AZ", // none
// http://en.wikipedia.org/wiki/ISO_3166-2:NG
"Biafra": "NG-BI", // none
// http://en.wikipedia.org/wiki/ISO_3166-2:NO
@ -125,11 +127,11 @@
"South Africa", "Swaziland", "Transkei", "Venda"
],
"Western Africa": [
"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"
"Ascension", "Azawad", "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": {
@ -302,6 +304,7 @@
"Georgia": ["Abkhazia", "South Ossetia"],
"Indonesia": ["East Timor"],
"Iraq; Saudi Arabia": ["Neutral Zone"],
"Mali": ["Azawad"],
"Moldova": ["Transnistria"],
"Morocco": ["Sahrawi"],
"New Hebrides": ["Tafea", "Tanna", "Vemerana"],
@ -361,7 +364,10 @@
"United Arab Republic": "Flag of Syria",
// regexp fails
"Panama Canal Zone": "Panama Canal Zone Flag.png",
"Rwenzururu": "Rwenzururu flag.png"
"Rwenzururu": "Rwenzururu flag.png",
// ...
"Azawad": "MNLA flag",
"Sealand": "Flag of Sealand"
},
"flag_link": [
// these are dependent or dissolved countries that share their flag
@ -381,8 +387,10 @@
"Abu Dhabi": ["Abu Dhabi Region"],
"Ajman": ["Ajman Region"],
"Akrotiri and Dhekelia": ["Akrotiri, Cyprus", "Dhekelia, Cyprus"],
"Ashmore and Cartier Islands": ["Cartier Island"],
"Azawad": ["Gao Region, Mali", "Kidal Region, Mali", "Tombouctou Region, Mali"],
"Biafra": ["Bayelsa, Nigeria", "Cross River, Nigeria", "Enugu, Nigeria"],
"Bonaire, Sint Eustatius and Saba": ["Bonaire", "Saba, Netherlands Antilles", "Sint Eustatius"],
"Bonaire, Sint Eustatius and Saba": ["Bonaire", "Saba Island", "Sint Eustatius"],
"Bophuthatswana": ["Babelegi, South Africa", "Gaberone, Botswana", "Hotazel, South Africa", "Maseru, Lesotho"], // approximate
"British Honduras": ["Belize"],
"Byelorussian Soviet Socialist Republic": ["Belarus"],
@ -923,7 +931,9 @@
"The Bahamas": "Bahamas",
"The Gambia": "Gambia",
"Trust Territory of the Pacific Islands": "Pacific Islands",
"Yemen Arab Republic": "North Yemen"
"Yemen Arab Republic": "North Yemen",
// decode
"GilgitBaltistan": "Gilgit-Baltistan"
},
"wikipedia": [
// http://en.wikipedia.org/wiki/ISO_3166-2:GB
@ -973,6 +983,8 @@
"Autonomous Region of Bougainville",
"Chechen Republic of Ichkeria",
"Mohéli",
// http://en.wikipedia.org/wiki/List_of_sovereign_states_in_the_2010s
"Azawad",
// ...
"Sealand",
// http://en.wikipedia.org/wiki/Territorial_claims_in_Antarctica

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

View file

@ -149,11 +149,11 @@ def get_country_data(country):
file = DATA['flag'][name] if DATA['flag'][name][-4:] == '.png' else DATA['flag'][name] + '.svg'
country['flagURL'] = get_flag('File:' + file)
else:
match = re.search('vertical-align:middle;?"( align="center")?><a href="/wiki/(File:.*?)"', html)
match = re.search('width:58%; vertical-align:middle;?"( align="center")?><a href="/w/index\.php\?title=(File:.*?)(&amp;page=1)?"', html)
if not match:
match = re.search('"/wiki/(File:Flag_.*?\.svg)"', html)
match = re.search('"/w/index\.php\?title=(File:Flag_.*?\.svg)(&amp;page=1)?"', html)
if match:
country['flagURL'] = get_flag(match.group(len(match.groups())))
country['flagURL'] = get_flag(match.group(len(match.groups()) - 1))
# google
if name in DATA['google']:
country['googleName'] = DATA['google'][name]

View file

@ -5,7 +5,6 @@ To create Ox.Geo/json/Ox.Geo.json and Ox.Geo/png/*
- run python /py/png.py
use the -nopng option if you don't want to skip the few flags that only exist as png, not as svg
- open html/geo.html, wait, and save json as json/countries.json
CAUTION: SEVERAL PLACES, AT LEAST Ashmore and Cartier Islands AND Midway Islands, NO LONGER RESOLVE
- run python py/fix.py
- save json/countries.json as source/Ox.Geo/json/Ox.Geo.json
- copy png/icons/ to source/Ox.Geo/png/flags/ (16, 64 and 256 is probably enough)

View file

@ -101,4 +101,5 @@
2006-06-05 Serbia and Montenegro < Serbia / Montenegro
2008-02-17 Serbia - Kosovo
2010-10-10 Netherlands Antilles < Bonaire, Sint Eustatius and Saba / Curaçao / Sint Maarten
2011-07-09 Sudan - South Sudan
2011-07-09 Sudan - South Sudan
2012-04-06 Mali - Azawad