1
0
Fork 0
forked from 0x2620/oxjs

update Geo module

This commit is contained in:
rolux 2012-04-03 00:20:18 +02:00
commit 0bf4d5a0f5
5 changed files with 582 additions and 62 deletions

View file

@ -250,7 +250,7 @@
},
"dependencies": {
"Argentina": ["Argentine Antarctica"],
"Argentina, Australia, Chile, France, New Zealand, Norway, United Kingdom": ["Antarctica"],
"Argentina; Australia; Chile; France; New Zealand; Norway; United Kingdom": ["Antarctica"],
"Australia": [
"Ashmore and Cartier Islands", "Australian Antarctic Territory", "Christmas Island", "Cocos Islands", "Coral Sea Islands",
"Heard Island and McDonald Islands", "Norfolk Island"
@ -266,7 +266,7 @@
"New Caledonia", "Réunion", "Saint Barthélemy", "Saint Martin", "Saint Pierre and Miquelon",
"Wallis and Futuna"
],
"France, United Kingdom": ["New Hebrides"],
"France; United Kingdom": ["New Hebrides"],
"Guernsey": ["Alderney", "Herm", "Sark"],
"India": ["Jammu and Kashmir"],
"Netherlands": [
@ -287,7 +287,7 @@
"Saint Christopher-Nevis-Anguilla", "Saint Helena, Ascension and Tristan da Cunha", "Scotland", "South Georgia and the South Sandwich Islands", "Southern Rhodesia",
"Trucial States", "Turks and Caicos Islands", "Wales"
],
"United Kingdom, United States": ["Canton and Enderbury Islands"],
"United Kingdom; United States": ["Canton and Enderbury Islands"],
"United States": [
"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",
@ -301,7 +301,7 @@
"Cyprus": ["Northern Cyprus"],
"Georgia": ["Abkhazia", "South Ossetia"],
"Indonesia": ["East Timor"],
"Iraq, Saudi Arabia": ["Neutral Zone"],
"Iraq; Saudi Arabia": ["Neutral Zone"],
"Moldova": ["Transnistria"],
"Morocco": ["Sahrawi"],
"New Hebrides": ["Tafea", "Tanna", "Vemerana"],

View file

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import codecs
import json
import os
import ox
@ -96,7 +97,6 @@ def get_countries():
'country': data['dependency'],
'date': country['created']['date']
}
sys.exit()
# Flags
countries = sorted(countries, key=sort)
flags = get_flags(countries)
@ -126,14 +126,14 @@ def get_country_data(country):
country['created'] = DATA['created'][name]
# dependencies
for c, d in DATA['dependencies'].iteritems():
c = c.split(', ')
c = c.split('; ')
if name in c:
country['dependencies'] = d if not 'dependencies' in country else country['dependencies'] + d
elif name in d:
country['dependency'] = c if not 'dependency' in country else country['dependency'] + c
# disputes
for c, d in DATA['disputes'].iteritems():
c = c.split(', ')
c = c.split('; ')
if name in c:
country['disputes'] = d if not 'disputes' in country else country['disputes'] + d
elif name in d:
@ -261,7 +261,7 @@ def parse_txt():
'dissolved': {},
'independence': {}
}
f = open('../txt/countries.txt')
f = codecs.open('../txt/countries.txt', 'r', 'utf-8')
lines = map(lambda x: x.strip(), f.readlines())
f.close()
for line in filter(lambda x: x[0] != '#', lines):

View file

@ -1,3 +1,4 @@
# FIXME: character encoding doesn't work!
# see http://en.wikipedia.org/wiki/List_of_sovereign_states_by_date_of_formation
# a < b / c a splits into b and c
# a / b > c a and b join as c
@ -16,7 +17,7 @@
1971-12-02 Abu Dhabi / Ajman / Dubai / Fujairah / Sharjah / Umm al-Quwain > United Arab Emirates
1971-12-16 United Kingdom * Bahrain
1971-12-16 Pakistan - Bangladesh
1972-02-11 Ras al Khaimah + United Arab Emirates
1972-02-11 Ras al-Khaimah + United Arab Emirates
1972-05-22 Ceylon = Sri Lanka
1973-06-01 British Honduras = Belize
1973-07-10 United Kingdom * Bahamas
@ -30,7 +31,9 @@
1975-07-06 France * Comoros
1975-07-12 Portugal * São Tomé and Príncipe
1975-09-16 Australia * Papua New Guinea
1975-08-01 Portugal - Cabinda
1975-11-11 Portugal * Angola
1975-11-11 Cabinda + Angola
1975-11-25 Netherlands * Suriname
1975-11-30 Dahomey = Benin
1976-01-01 Gilbert and Ellice Islands < Ellice Islands / Gilbert Islands
@ -56,6 +59,7 @@
1984-01-01 United Kingdom * Brunei
1984-08-04 Upper Volta = Burkina Faso
1986 Johnston Island / Midway Islands / United States Miscellaneous Pacific Islands / Wake Island > United States Minor Outlying Islands
1986-01-01 Netherlands Antilles - Aruba
1986-10-21 Pacific Islands - Marshall Islands
1986-11-03 Pacific Islands - Micronesia
1989-05-01 Kampuchea = Cambodia
@ -93,7 +97,7 @@
1998-12-24 Bougainville + Papua New Guinea
2000-02-06 Chechnia + Russia
2002-03-10 Anjouan / Mohéli + Comoros
2002-05-20 East Timor = Timor Leste
2002-05-20 East Timor = Timor-Leste
2003-02-04 Yugoslavia = Serbia and Montenegro
2006-06-05 Serbia and Montenegro < Serbia / Montenegro
2008-02-17 Serbia - Kosovo