dr5hn / countries-states-cities-database

🌍 Discover our global repository of countries, states, and cities! 🏙️ Get comprehensive data in JSON, SQL, PSQL, XML, YAML, and CSV formats. Access ISO2, ISO3 codes, country code, capital, native language, timezones (for countries), and more. #countries #states #cities
https://dr5hn.github.io/countries-states-cities-database/
Open Data Commons Open Database License v1.0
7.36k stars 2.56k forks source link

Timezone, normalize names, language. Fix curencies #101

Closed rodolfosouza closed 3 years ago

rodolfosouza commented 4 years ago

Nice job my friend 👍

could you please add the following:

fix currencies: Lithuania = EUR Zambia = ZMW Belarus = BYN

project reference https://restcountries.eu (always up-to-date)

thanks in advance

dr5hn commented 4 years ago

@rodolfosouza Thanks for reporting and your suggestions. 🎉

I've fixed currencies for now. Please verify. #102

Will look into enhancements soon.

Stats:

dereuromark commented 3 years ago

Here is also a CSV if we want to get it started.

How would you prefer to store the data in the records?

Country,Timezone,http://fasteri.com/list/19/time-zones-by-country
Afghanistan,UTC+04:30
Albania,UTC+01
Algeria,UTC
American Samoa,UTC-11
Andorra,UTC+01
Angola,UTC+01
Anguilla,UTC-04
Antigua and Barbuda,UTC-04
Argentina,UTC-03
Armenia,UTC+04
Aruba,UTC-04
Ascension Island,UTC
Australia,UTC+07 - UTC+10
Austria,UTC+01
Azerbaijan,UTC+04
Bahamas,UTC-05
Bahrain,UTC+03
Bangladesh,UTC+06
Barbados,UTC-04
Belarus,UTC+03
Belgium,UTC+01
Belize,UTC-06
Benin,UTC+01
Bermuda,UTC-04
Bhutan,UTC+05:30
Bolivia,UTC-04
Bosnia and Herzegovina,UTC+01
Botswana,UTC+02
Brazil,UTC-05 - UTC-03
British Indian Ocean Territory,UTC+06
Brunei,UTC+08
Bulgaria,UTC+02
Burkina Faso,UTC
Burundi,UTC+02
Cambodia,UTC+07
Cameroon,UTC+01
Canada,UTC-08 - UTC-04
Cape Verde,UTC-01
Cayman Islands,UTC-05
Central African Republic,UTC+01
Chad,UTC+01
Chile,UTC-04
China,UTC+08
Christmas Island,UTC+07
Cocos (Keeling) Islands,UTC+06:30
Colombia,UTC-05
Comoros,UTC+03
"Congo, Republic of the",UTC+01
"Congo, the Democratic Republic of the",UTC+01 - UTC+02
Cook Islands,UTC-10
Costa Rica,UTC-06
Croatia,UTC+01
Cuba,UTC-03
Cyprus,UTC+02
Czech Republic,UTC+01
Denmark,UTC+01
Diego Garcia,UTC+05
Djibouti,UTC+03
Dominica,UTC-04
Dominican Republic,UTC-04
East Timor,UTC+09
Ecuador,UTC-05
Egypt,UTC+02
El Salvador,UTC-06
Equatorial Guinea,UTC+01
Eritrea,UTC+03
Estonia,UTC+03
Ethiopia,UTC+03
Falkland Islands (Malvinas),UTC-04
Faroe Islands,UTC
Fiji,UTC+12
Finland,UTC+02
France,UTC+01
French Guiana,UTC-04
French Guiana,UTC-01
French Polynesia,UTC-10
Gabon,UTC+01
Gambia,UTC
Georgia,UTC+04
Germany,UTC+01
Ghana,UTC
Gibraltar,UTC+01
Greece,UTC+02
Greenland,UTC-03
Grenada,UTC-04
Guadeloupe,UTC-04
Guam,UTC+10
Guatemala,UTC-06
Guernsey,UTC
Guinea,UTC
Guinea-Bissau,UTC
Guyana,UTC-03
Haiti,UTC-05
Heard Island and McDonald Islands,UTC+05
Honduras,UTC-06
Hong Kong,UTC+08
Hungary,UTC+01
Iceland,UTC
India,UTC+05:30
Indonesia,UTC+07 - UTC+09
Iran,UTC+03:30
Iraq,UTC+03
Ireland,UTC
Isle of Man,UTC
Israel,UTC+02
Italy,UTC+01
Ivory Coast,UTC
Jamaica,UTC-05
Japan,UTC+09
Jersey,UTC
Jordan,UTC+02
Kazakhstan,UTC+06
Kenya,UTC+03
Kiribati,UTC+12
Kuwait,UTC+03
Kyrgyzstan,UTC+06
Laos,UTC+07
latvia,UTC+03
Lebanon,UTC+02
Lesotho,UTC+02
Liberia,UTC
Libya,UTC+02
Liechtenstein,UTC+01
Lithuania,UTC+02
Luxembourg,UTC+01
Macau,UTC+08
Macedonia,UTC+01
Madagascar,UTC+03
Malawi,UTC+02
Malaysia,UTC+08
Maldives,UTC+05
Mali,UTC
Malta,UTC+01
Marshall Islands,UTC+10
Martinique,UTC-04
Mauritania,UTC
Mauritius,UTC+04
Mayotte,UTC+03
Mexico,UTC-08 - UTC-06
"Micronesia, Federated States of",UTC+10
"Moldova, Republic of",UTC+03
Monaco,UTC+01
Mongolia,UTC+08
Montenegro,UTC+01
Montserrat,UTC-04
Morocco,UTC
Mozambique,UTC+02
Myanmar (Burma),UTC+06:30
Namibia,UTC+02
Nauru,UTC+12
Nepal,UTC+05:30
Netherlands,UTC+01
Netherlands Antilles,UTC-04
New Caledonia,UTC+11
New Zealand,UTC+12
Nicaragua,UTC-06
Niger,UTC+01
Nigeria,UTC+01
Niue,UTC-11
Norfolk Island,UTC+11:30
North Korea,UTC+09
Northern Mariana Islands,UTC+10
Norway,UTC+01
Oman,UTC+04
Pakistan,UTC+05
Palau,UTC+09
"Palestinian Territory, Occupied",UTC+02
Panama,UTC-05
Papua New Guinea,UTC+10
Paraguay,UTC-04
Peru,UTC-05
Philippines,UTC+08
Pitcairn,UTC-08
Poland,UTC+01
Portugal,UTC+01
Puerto Rico,UTC-04
Qatar,UTC+03
Réunion,UTC+04
Romania,UTC+02
Russia,UTC+03
Rwanda,UTC+02
Saint Barthélemy,UTC-04
Saint Helena,UTC
Saint Kitts and Nevis,UTC-04
Saint Lucia,UTC-04
Saint Martin (French part),UTC-04
Saint Pierre and Miquelon,UTC-03
Saint Vincent and the Grenadines,UTC-04
Samoa,UTC-11
San Marino,UTC+01
São Tomé and Príncipe,UTC
Saudi Arabia,UTC+03
Senegal,UTC
Serbia,UTC+01
Seychelles,UTC+04
Sierra Leone,UTC
Singapore,UTC+08
Slovakia,UTC+01
Slovenia,UTC+01
Solomon Islands,UTC+11
Somalia,UTC+03
South Africa,UTC+02
South Georgia and the South Sandwich Islands,UTC-02
South Korea,UTC+09
Spain,UTC+01
Sri Lanka,UTC+05:30
Sudan,UTC+02
Suriname,UTC-03:30
Swaziland,UTC+02
Sweden,UTC+01
Switzerland,UTC+01
Syrian Arab Republic,UTC+02
Taiwan,UTC+08
Tajikistan,UTC+06
Tanzania,UTC+03
Thailand,UTC+07
Togo,UTC
Tokelau,UTC-10
Tonga,UTC+13
Trinidad and Tobago,UTC-04
Tunisia,UTC+01
Turkey,UTC+02
Turkmenistan,UTC+05
Turks and Caicos Islands,UTC-05
Tuvalu,UTC+12
Uganda,UTC+03
Ukraine,UTC+03
United Arab Emirates,UTC+04
United Kingdom,UTC
United States,UTC-11 - UTC-05
Uruguay,UTC-03
Uzbekistan,UTC+06
Vanuatu,UTC+11
Vatican City,UTC+01
Venezuela,UTC-04
Vietnam,UTC+07
"Virgin Islands, British",UTC-04
"Virgin Islands, U.S.",UTC-04
Wallis and Futuna,UTC+12
Yemen,UTC+03
Zambia,UTC+02
Zimbabwe,UTC+02
dr5hn commented 3 years ago

@dereuromark Woohoo... 🎉 Thanks for CSV.

I also want to add a Timezone abbreviation, from this source. Timezone Abbreviations & Offsets

I want to put it this way:

{
  "id": 101,
  "name": "India",
  "iso3": "IND",
  "iso2": "IN",
  "phone_code": "91",
  "capital": "New Delhi",
  "currency": "INR",
  "native": "भारत",
  "region": "Asia",
  "subregion": "Southern Asia",
  "emoji": "🇮🇳",
  "emojiU": "U+1F1EE U+1F1F3",
+ "timezoneAbbr": "IST"
+ "timezoneOff": "UTC+05:30"
}

or this way

{
  "id": 101,
  "name": "India",
  "iso3": "IND",
  "iso2": "IN",
  "phone_code": "91",
  "capital": "New Delhi",
  "currency": "INR",
  "native": "भारत",
  "region": "Asia",
  "subregion": "Southern Asia",
  "emoji": "🇮🇳",
  "emojiU": "U+1F1EE U+1F1F3",
+ "timezone": {
+    "abbreviation": "IST",
+    "offset": "UTC+05:30"
+ }
}
dereuromark commented 3 years ago

Keeping the list flat could be easier to convert to e.g. csv But in the end both would work fine.

dr5hn commented 3 years ago

@dereuromark You're right !! 👍🏼

If we consider exporting to CSV, We need to keep the structure flat.

So let's keep the structure flat, Btw are you going to work on this?

dereuromark commented 3 years ago

I can help in assisting capacity One question would be: How do you want to handle the ranges? E.g. US or Russia with multiple timezones?

Your suggestion shows only one As you can see from my csv, a range of hours is likely, and so is also the range of abbr (or acronyms) then

dr5hn commented 3 years ago

@dereuromark Hmm. That's a good question.

As I see in this source RestCountries They've managed to get them in an array.

We can do the same. What say?

dereuromark commented 3 years ago

So you mean sth like

+ "timezones": {
+    "UTC+05:00": "XYZ",
+    "UTC+06:00": "ABC",
+    "UTC+07:00": "" // In case this doesnt have its own name?
+ }
}

This way we wouldn't need the key names as it is clear from "offset => name" way

For CSV, this could be pipe/semicolon,comma separated then:

UTC+05:00 (XYZ) | ...

But that part is optional anyway, I think the main focus should be the JSON format.

dr5hn commented 3 years ago

@dereuromark This is good. As far as I see, each timezone offset has its own abbreviation. So no offset will remain blank.

Just a suggestion. I think we need to rotate the position of the key & value to make it accessible easily.

+ "timezones": {
+    XYZ: "UTC+05:00",
+    ABC: "UTC+06:00",
+    PQE: "UTC+07:00"
+ }

Since the key is one word, the user can access it easily by timezones.XYZ.

dereuromark commented 3 years ago

I looked at the ranges again and

AET | Australian Eastern Time | UTC+10/UTC+11

shows that AET would not be clear, so the other way around would be:

+ "timezones": {
+    "UTC+05:00" => ABC,
+    "UTC+06:00" => ABC,
+    "UTC+07:00" => ABC
+ }

The key lookup is very unlikely anyway, most would just iterate over them to get both key and value.

dr5hn commented 3 years ago

@dereuromark Hmm... I see.

Ok then let's make it this way.

+ "timezones": {
+    "UTC+05:30" => "IST (Indian Standard Time)",
+    "UTC+01" => "IST (Irish Standard Time)",
+    "UTC+02" => "IST (Israel Standard Time)"
+ }

I will work on this.

valerianpereira commented 3 years ago

@dereuromark Hmm... I see.

Ok then let's make it this way.

+ "timezones": {
+    "UTC+05:30" => "IST (Indian Standard Time)",
+    "UTC+01" => "IST (Irish Standard Time)",
+    "UTC+02" => "IST (Israel Standard Time)"
+ }

I will work on this.

UTC+01 means IST (Irish Standard Time) as well as Central European Time as well as Middle European Time Same zone as CET and a lot more...

dereuromark commented 3 years ago

UTC+01 means IST (Irish Standard Time) as well as Central European Time as well as Middle European Time Same zone as CET and a lot more...

That is true.. But for each country there is only one specific one, though. And that's what the key value pair here stands for.

In general we also still need (e.g. in PHP) world the America/Toronto way on top of the above config, as this is what the coding language needs to switch the timezone config. But that mapping could also be handled outside of this lib.

dr5hn commented 3 years ago

@dereuromark Finally timezones have been added to countries.

Thank you so much for your help I really appreciate it 👍🏼

dereuromark commented 3 years ago

I checked the data set

Bouvet Island, Heard and McDonald Islands, Kosovo, Netherlands Antilles

Those do not have any timezone data yet, but I guess they don't officially use one then?

dr5hn commented 3 years ago

@dereuromark Thanks for checking.

Or may be I have missed them. I will take a look once again.

dr5hn commented 3 years ago

@dereuromark Fixed in #148.