porimol / countryinfo

A python module for returning data about countries, ISO info and states/provinces within them.
MIT License
140 stars 44 forks source link

Country #44

Open mglt opened 2 years ago

mglt commented 2 years ago

My code co2eq needs to instantiates country_info by name, iso and relay on capital and capital_latlng. In this PR, I tried that all country_info can be instantiated from a name, the iso codes. I also tried to have capital and capital_latlgn provided. Some data have been corrected, the newly data added are corrected, but I have not checked manually all data. Tests used to perform the changes are available in test_utils.py and exact changes have been logged.

Some capital/capital_latlgn values may need to be documented.

name ISO2 capital/capital_lat_lgn
United States Minor Outlying Islands UM None / None
Bonaire, Sint Eustatius and Saba BQ 3 cities
Bouvet Island BV None / None
Antartica AQ None / None
Heard Island and McDonald Islands HM None / None

I also found out that nativeName is a single string, but it is quite common that one country has multiple language and as such multiple nativeName. I am wondering if that would not make sense to rater consider nativeName to be a list as opposed to a string.

Here is a summary of the actions performed.

  1. any ISO code and official designation can be used to instantiate a country_info. I mostly sync the data provided by pycountry to country_info. The exact change can be viewed in pycountry.log or commit 0a7a8f39f1313f99160c43486e594bca15c9473a

  2. I check whether commonly used designation for country can be used to instantiate a country_info object. Exact changes can be viewed in alt_country_list.log and commit ff06d6d653c27a93a49b62edebddbeb886de0284

  3. I removed duplicated and void files. Exact changes can be viewed in double_and_void_file.log and commit 5ea2bcdf011a85aa28d74b0497b81682f5efb087

  4. Completing myanmar, andorra, vatican, jamaica manually

  5. I tried to cross check with nominatim the capital latlgn. This include a) correcting some coordinates, creating entries. Note that the corrections have only been applied to entries when the reverse resolution of the coordinates provided by nominatim corresponds to the expected country. This means that note all errors have been caught. I also used nominatim to add the translation field and check the nativeName field. commit b116c8c33c423e1a90f50bddc78d54b84e95358a and nominatim.log details the actions performed.