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> </script>
> Ox.COUNTRIES.length > Ox.COUNTRIES.length
353 354
> Ox.sum(Ox.test.array) > Ox.sum(Ox.test.array)
353 354
> Ox.test.array > Ox.test.array
[196, 73, 9, 8, 28, 24, 14, 1] [196, 73, 10, 8, 28, 24, 14, 1]
@*/ @*/
Ox.COUNTRIES = data; Ox.COUNTRIES = data;

View file

@ -1,5 +1,5 @@
/* /*
353 countries 354 countries
-- sovereign, dependent and disputed countries according to -- sovereign, dependent and disputed countries according to
http://en.wikipedia.org/wiki/List_of_sovereign_states http://en.wikipedia.org/wiki/List_of_sovereign_states
-- entities with country codes, according to -- entities with country codes, according to
@ -47,6 +47,8 @@
"Mohéli": "KM-M", "Mohéli": "KM-M",
// http://en.wikipedia.org/wiki/ISO_3166-2:MD // http://en.wikipedia.org/wiki/ISO_3166-2:MD
"Transnistria": "MD-SN", "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 // http://en.wikipedia.org/wiki/ISO_3166-2:NG
"Biafra": "NG-BI", // none "Biafra": "NG-BI", // none
// http://en.wikipedia.org/wiki/ISO_3166-2:NO // http://en.wikipedia.org/wiki/ISO_3166-2:NO
@ -125,11 +127,11 @@
"South Africa", "Swaziland", "Transkei", "Venda" "South Africa", "Swaziland", "Transkei", "Venda"
], ],
"Western Africa": [ "Western Africa": [
"Ascension", "Benin", "Biafra", "Burkina Faso", "Cape Verde", "Ascension", "Azawad", "Benin", "Biafra", "Burkina Faso",
"Côte d'Ivoire", "Dahomey", "Gambia", "Ghana", "Guinea", "Cape Verde", "Côte d'Ivoire", "Dahomey", "Gambia", "Ghana",
"Guinea-Bissau", "Liberia", "Mali", "Mauritania", "Niger", "Guinea", "Guinea-Bissau", "Liberia", "Mali", "Mauritania",
"Nigeria", "Saint Helena, Ascension and Tristan da Cunha", "Senegal", "Sierra Leone", "Togo", "Niger", "Nigeria", "Saint Helena, Ascension and Tristan da Cunha", "Senegal", "Sierra Leone",
"Tristan da Cunha", "Upper Volta" "Togo", "Tristan da Cunha", "Upper Volta"
] ]
}, },
"Antarctica": { "Antarctica": {
@ -302,6 +304,7 @@
"Georgia": ["Abkhazia", "South Ossetia"], "Georgia": ["Abkhazia", "South Ossetia"],
"Indonesia": ["East Timor"], "Indonesia": ["East Timor"],
"Iraq; Saudi Arabia": ["Neutral Zone"], "Iraq; Saudi Arabia": ["Neutral Zone"],
"Mali": ["Azawad"],
"Moldova": ["Transnistria"], "Moldova": ["Transnistria"],
"Morocco": ["Sahrawi"], "Morocco": ["Sahrawi"],
"New Hebrides": ["Tafea", "Tanna", "Vemerana"], "New Hebrides": ["Tafea", "Tanna", "Vemerana"],
@ -361,7 +364,10 @@
"United Arab Republic": "Flag of Syria", "United Arab Republic": "Flag of Syria",
// regexp fails // regexp fails
"Panama Canal Zone": "Panama Canal Zone Flag.png", "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": [ "flag_link": [
// these are dependent or dissolved countries that share their flag // these are dependent or dissolved countries that share their flag
@ -381,8 +387,10 @@
"Abu Dhabi": ["Abu Dhabi Region"], "Abu Dhabi": ["Abu Dhabi Region"],
"Ajman": ["Ajman Region"], "Ajman": ["Ajman Region"],
"Akrotiri and Dhekelia": ["Akrotiri, Cyprus", "Dhekelia, Cyprus"], "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"], "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 "Bophuthatswana": ["Babelegi, South Africa", "Gaberone, Botswana", "Hotazel, South Africa", "Maseru, Lesotho"], // approximate
"British Honduras": ["Belize"], "British Honduras": ["Belize"],
"Byelorussian Soviet Socialist Republic": ["Belarus"], "Byelorussian Soviet Socialist Republic": ["Belarus"],
@ -923,7 +931,9 @@
"The Bahamas": "Bahamas", "The Bahamas": "Bahamas",
"The Gambia": "Gambia", "The Gambia": "Gambia",
"Trust Territory of the Pacific Islands": "Pacific Islands", "Trust Territory of the Pacific Islands": "Pacific Islands",
"Yemen Arab Republic": "North Yemen" "Yemen Arab Republic": "North Yemen",
// decode
"GilgitBaltistan": "Gilgit-Baltistan"
}, },
"wikipedia": [ "wikipedia": [
// http://en.wikipedia.org/wiki/ISO_3166-2:GB // http://en.wikipedia.org/wiki/ISO_3166-2:GB
@ -973,6 +983,8 @@
"Autonomous Region of Bougainville", "Autonomous Region of Bougainville",
"Chechen Republic of Ichkeria", "Chechen Republic of Ichkeria",
"Mohéli", "Mohéli",
// http://en.wikipedia.org/wiki/List_of_sovereign_states_in_the_2010s
"Azawad",
// ... // ...
"Sealand", "Sealand",
// http://en.wikipedia.org/wiki/Territorial_claims_in_Antarctica // 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' file = DATA['flag'][name] if DATA['flag'][name][-4:] == '.png' else DATA['flag'][name] + '.svg'
country['flagURL'] = get_flag('File:' + file) country['flagURL'] = get_flag('File:' + file)
else: 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: 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: if match:
country['flagURL'] = get_flag(match.group(len(match.groups()))) country['flagURL'] = get_flag(match.group(len(match.groups()) - 1))
# google # google
if name in DATA['google']: if name in DATA['google']:
country['googleName'] = DATA['google'][name] 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 - 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 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 - 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 - run python py/fix.py
- save json/countries.json as source/Ox.Geo/json/Ox.Geo.json - 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) - copy png/icons/ to source/Ox.Geo/png/flags/ (16, 64 and 256 is probably enough)

View file

@ -102,3 +102,4 @@
2008-02-17 Serbia - Kosovo 2008-02-17 Serbia - Kosovo
2010-10-10 Netherlands Antilles < Bonaire, Sint Eustatius and Saba / Curaçao / Sint Maarten 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