World `countries` – database table for MySQL
echobehind.wordpress.com
echobehind.wordpress.com
* Territories such as Réunion are listed as countries
* Countries that ceased to exist are not listed (Yugoslavia, Soviet Union) although the world's most recent new country (South Sudan) is listed.
* Kosovo is listed, although not recognised by all the world. Transnistria is not listed, even though it has de facto sovereignty.
* Total land area is a disputable amount in several circumstances.
There are several more such examples I could list.
Yes I'm being pedantic. But I have a special interest in this area, and I'm aware of just how hard it is. People are born in one country (Soviet Union) and die in another (Ukraine), even though they never moved from their home city (Odessa).
I used bilateral migration data from the World Bank to do it: http://data.worldbank.org/data-catalog/global-bilateral-migr...
I thought this might produce complexities I'd have to deal with, since over the 50 year period this data set covers, countries have come and gone a number of times. But to my surprise, the data set somehow uses only current countries, even when giving data points for 1960 or 1970. It doesn't really explain how that happened, either. Did they somehow impute past data to current countries? What does the 1970 figure for Germany, or Serbia, actually mean? Something was too complex and didn't fit the database, so it got swept under the rug? Made my job writing this off-the-cuff blog post much easier, but now I'm left wondering what the data I used actually means, despite it coming from a highly respected source, and used in many academic papers.
edit: Found a paper describing the construction of the World Bank data. It looks like they use what they describe as an admittedly crude method of attributing based on population shares, so e.g. immigrants to "Yugoslavia" are apportioned to Croatia/Serbia/etc. based on population share, assuming the immigration was uniform throughout. Not horrible as a first approximation, probably, though clearly not "right" either. Source: http://papers.ssrn.com/sol3/papers.cfm?abstract_id=969242
You really do have to leave any hope of perfectionism at the door when it comes to migration data.
Even if record-keeping were consistent, a considerable amount of migration goes unrecorded — mass migration due to environmental disasters or conflict, illegal immigration, etc.
There are very few countries that can claim to know the exact number of people within their borders at any given time, let alone where they came from.
People are even born in one city (Leningrad) in one country (Soviet Union) and die in another city (St-Petersburg) in another country (Russia), although they never moved.
You probably still could go with "Russia" every time.
if by 'de facto sovereignty' you mean not being recognized by any country aka their passports being worthless. a database should not make political statements. if they earn recognition, they'll be listed. there are dozens of separatist territories in the world who claim sovereignty. if Transnistria were to be listed as a country - why not Karabakh? not to mention autonomous regions like Iraqi Kurdistan.
IIRC, the Syrian government banned Facebook from Syria, because Golan Heights (occupied and annexed by Israel, but not recognised by most (or any?) other countries) was listed in Facebook as being in Israel.
Taiwan is partially recognized too (by a comparable number of states), but it is listed.
There should perhaps be a "disputed" flag - raise, you got all the territories, clean - only solid recognized states.
Iraqi Kurdistan is a different situation. They are autonomous, not a breakaway region.
Ox.load('Geo', function() { Ox.print(Ox.COUNTRIES); })
Being the author of said library, I can confirm that compiling and maintaining a list of countries is hard, and will never be 100% "objective". > Countries that ceased to exist are not listed
Where I work, we have a very thoroughly compiled list of countries for our user profile "Country" dropdown. It never ceases to amuse me that people signing up for our services are given choices such as:- Neutral Zone - Union of Soviet Socialist Republics - Unknown or Invalid Region
I think it's from the framework we use or something. I suppose it is somewhat reassuring that we're prepared if the USSR ever re-emerges or another Gulf War breaks out.
We have a similarly thorough list of possible languages for another dropdown which is used to indicate the language of the things our users create. If SignWriting ever gets absorbed into Unicode, we'll be prepared with our "Sign Language" dropdown option.
This is one case where I think DRY would be worse because the special cases that apply to one do not apply to the other semantically, and therefore the logic would get very subtle and muddy.
TimeZoneDB provides free time zone database for cities of the world. The database is licensed under Creative Commons Attribution 3.0 License. It contains countries name, time zones, abbreviation, GMT offset, and Daylight Saving Time (DST). The data is available in CSV and SQL format. You can download and implement into your projects for free.
http://www.unicode.org/cldr/data/charts/summary/root.html
This list also has currencies and some other stuff, but a Ruby script to extract what you want should not take more than 10 lines.
This list has the added advantage of being available in pretty much all the languages in the world, in case you need localisation for your project.
Side note: if you want to check if a list is up to date, check for "Aruba" and country code BQ (Caribbean). They changed the status of independent country a year ago so many lists don't have it yet (used to be a Dutch colony).
https://github.com/sixarm/sixarm_data_geolocation
Suggestions welcome.
A Wiki for massive amounts of data that is basically common knowledge.
http://data.brighterplanet.com/countries
and a lot more like it at: