Giter Site home page Giter Site logo

mledoze / countries Goto Github PK

View Code? Open in Web Editor NEW
5.9K 5.9K 1.3K 28.06 MB

World countries in JSON, CSV, XML and Yaml. Any help is welcome!

Home Page: https://mledoze.github.io/countries/

License: Open Data Commons Open Database License v1.0

PHP 99.56% JavaScript 0.44%
countries csv geojson json php topojson xml yaml

countries's People

Contributors

alexsegura avatar alxnull avatar blacksmoke26 avatar blumk avatar cedric-anne avatar dependabot[bot] avatar emilv avatar fayderflorez avatar herrjemand avatar hinell avatar jamespwilliams avatar jremes-foss avatar marnusw avatar martinheidegger avatar michalvavra avatar mledoze avatar nabela avatar oscerd avatar paulvollmer avatar petert82 avatar ricardograca avatar robindaumann avatar soungrong avatar stephenpaulger avatar stevep-arm avatar ted451 avatar thachhoang avatar thevuong avatar twmbx avatar willettk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

countries's Issues

countries.php need help

I've just done modification to json as proposed by @mledoze and countries.php does not want to work. Here is what I get:

PHP Notice:  Array to string conversion in .../countries/countries.php on line 96

here is json:

[
    {
        "altSpellings": [
            "AF",
            "Af\u0121\u0101nist\u0101n"
        ],
        "area": 652230,
        "borders": [
            "IRN",
            "PAK",
            "TKM",
            "UZB",
            "TJK",
            "CHN"
        ],
        "callingCode": [
            "93"
        ],
        "capital": "Kabul",
        "cca2": "AF",
        "cca3": "AFG",
        "ccn3": "004",
        "currency": [
            "AFN"
        ],
        "demonym": "Afghan",
        "language": [
            "Pashto",
            "Dari"
        ],
        "languageCodes": [
            "ps",
            "uz",
            "tk"
        ],
        "latlng": [
            33,
            65
        ],
        "name": {
            "common": "Afghanistan",
            "native": {
                "common": "\u0627\u0641\u063a\u0627\u0646\u0633\u062a\u0627\u0646",
                "official": ""
            },
            "official": ""
        },
        "region": "Asia",
        "relevance": "0",
        "subregion": "Southern Asia",
        "tld": [
            ".af"
        ],
        "translations": {
            "cy": "Affganistan",
            "de": "Afghanistan",
            "es": "Afganist\u00e1n",
            "fr": "Afghanistan",
            "hr": "Afganistan",
            "it": "Afghanistan",
            "ja": "\u30a2\u30d5\u30ac\u30cb\u30b9\u30bf\u30f3",
            "nl": "Afghanistan",
            "ru": "\u0410\u0444\u0433\u0430\u043d\u0438\u0441\u0442\u0430\u043d"
        }
    },...

Export tags to packgist

It would be great to be able to check a specific tag out with composer. Ie. export the tags to packagist.org.

This way it is easier to manage dependencies, instead of getting dev master.

Please remove “Province of China” from Taiwan

Hi mledoze,

Thanks for this great work, really handy and useful. However it would be even nicer if you can leave Taiwan alone, without the “, Province of China” appendix.

Well it's entirely understandable that this label comes from the ISO 3166 list, but the current truth is Taiwan has its own government and elected president, own currency and own passport. So it would be really thankful if you can just call it “Taiwan” instead. ;)

Thanks anyway,
Zhusee

I need more data, but...

Hi there, I need the country codes, area codes and flags and structure around these. This information appears to be in a mix of here: http://www.wtng.info/wtng-ctn.html and Wikipedia, so I'm going to write an application in Nodejs that grabs the data from http://www.wtng.info/wtng-ctn.html and exports it to a file, allows overrides and merges with your data. I need to do this for work, hence why I want to contribute to this project if thats ok with you.

Bring nationalities into the fold

We're using the entire list to cross-fill in boxes when checking a country, and it seems strange that the list doesn't support nationalities yet. So, as an example:

{
  "name":{
     "common":"Netherlands",
     "official":"Netherlands",
     "native":{
        "common":"Nederland",
        "official":"Nederland"
     }
  },
  "tld":[
     ".nl"
  ],
  "cca2":"NL",
  "ccn3":"528",
  "cca3":"NLD",
  "currency":[
     "EUR"
  ],
  "callingCode":[
     "31"
  ],
  "capital":"Amsterdam",
  "altSpellings":[
     "NL",
     "Holland",
     "Nederland"
  ],
  "relevance":"1.5",
  "region":"Europe",
  "subregion":"Western Europe",
  "nativeLanguage":"nld",
  "languages":{
     "nld":"Dutch"
  },
  "translations":{
     "deu":"Niederlande",
     "fra":"Pays-Bas",
     "hrv":"Nizozemska",
     "ita":"Paesi Bassi",
     "jpn":"\u30aa\u30e9\u30f3\u30c0",
     "nld":"Nederland",
     "rus":"\u041d\u0438\u0434\u0435\u0440\u043b\u0430\u043d\u0434\u044b",
     "spa":"Pa\u00edses Bajos"
  },
  "latlng":[
     52.5,
     5.75
  ],
  "demonym":"Dutch",
  "borders":[
     "BEL",
     "DEU"
  ],
  "area":41850,
  "nationality":"Dutch",
  "nationalities":{
    "nld":"Nederlandse",
    "fra":"Néerlandaise",
    "deu":"Niederländer"
  }
}

Naturally, pay close attention to the last two keys.

Add country regions, provinces, cities and related infos

From https://github.com/ProGNOMmers
It would be wonderful if it would be possible to retrieve regions, provinces and cities.

Something like:

// Regions of country
// /rest/alpha2/it/regions ->
{ regions:  [ "Abruzzi e Molise",
              "Basilicata",
              "Calabria",
              "Campania",
              "Emilia-Romagna",
              "Friuli-Venezia Giulia",
              "Lazio",
              "Liguria",
              "Lombardia",
              "Marche",
              "Piemonte",
              "Puglia",
              "Sardegna",
              "Sicilia",
              "Toscana",
              "Trentino-Alto Adige",
              "Umbria",
              "Valle d'Aosta",
              "Veneto" ] }

// Provinces of region
// /rest/alpha2/it/regions/Veneto/provinces ->
{ provinces: [ "Verona", "Venezia", ... ] }

// Cities of province
// /rest/alpha2/it/regions/Veneto/provinces/Venezia/cities ->
{ cities: [ { name: "Venezia", zip_codes: [ "30121", ... , "30176" ] }, 
            { name: "Chioggia", zip_codes: [ "30015" ] },
            { name: "San Donà di Piave", zip_codes: [ "30027" ] }, 
            ... ] }

// Cities of country by name
// /rest/alpha2/it/regions/Veneto/provinces/Venezia/cities ->
{ cities: [ { name: "Venezia", zip_codes: [ "30121", ... , "30176" ] }, 
            { name: "Chioggia", zip_codes: [ "30015" ] },
            { name: "San Donà di Piave", zip_codes: [ "30027" ] }, 
            ... ] }

Cities could have metadata like f.i. zip codes, which are very useful.

It is a huge work because recording and maintaining the whole list of regions, provinces and cities for every world country is hard, but it is a good target to be accomplished by an open source project.

Fix the relevance parameter

As @nvitucci noted in #37, the relevance parameter contains inaccurate data.

the strange thing is to have countries like Austria or Chile with a weight of 0 while small countries like Andorra or Isle of Man have a weight of 0.5

We should fix this to make this parameter more relevant.

What data to add next?

I would like to discuss here the data that should be added to this repository.

A similar project like 0xJS [1] contains a lot more data such as the land area or the latitude/longitude coordinates of each country.

Is it interesting/useful to have this kind of data too?

Data that can be added:

  • land (land mass in square kilometers [3])
  • latitude (latitude coordinate of the capital [2])
  • longitude (longitude coordinate of the capital [2])
  • east (longitude of the country's eastern boundary [3])
  • north (latitude of the country's northern boundary [3])
  • south (latitude of the country's southern boundary [3])

What would you like to be added?

Please let me know in the comments.

[1] http://oxjs.org/#doc/Ox.COUNTRIES
[2] source: http://opengeocode.org/
[3] source: https://oxjs.org/#doc/Ox.COUNTRIES


From the comments

Should I encode my russian translated string to Unicode?

Hey there!

I really like your project and I'm ready to add russian translate for every single country name.

Just one question: should I encode that strings to Unicode strings like japanese ones? Russian string looks like this: ”Соединённые Штаты Америки“ (USA).

Thanks.

Svalbard and Jan Mayen issue.

"Svalbard and Jan Mayen (Norwegian: Svalbard og Jan Mayen, ISO 3166-1 alpha-2: SJ, ISO 3166-1 alpha-3: SJM, ISO 3166-1 numeric: 744) is a statistical designation defined by ISO 3166-1 of two parts of Norway under separate jurisdictions—Svalbard and Jan Mayen. While the two are combined for the purposes of the International Organization for Standardization (ISO) category, they are not administratively related." Wikipedia. https://en.wikipedia.org/wiki/Svalbard_and_Jan_Mayen

So they are administratively different, and Svalbard specifically is stated by Svalbard treaty: https://en.wikipedia.org/wiki/Svalbard_and_Jan_Mayen

Relationship between 'language' and 'languageCodes'

Firstly, thanks for compiling such an awesome dataset!

Secondly, I'm not sure if this is really an issue, or a misunderstanding on my part, but is there supposed to be any correspondence between the contents of language array and the contents of the languageCodes array?

For example, looking at a country like Canada, it seems that there is a relationship:

...
"language": ["English", "French"],
"languageCodes": ["en", "fr"],
...

language here appears to have the names of the languages from languageCodes and in the same order. But then looking at a country like Afghanistan things get less clear:

...
"language": ["Pashto", "Dari"],
"languageCodes": ["ps", "uz", "tk"],
...

Pashto has code 'ps', but the code for Dari is not listed (from a cursory wikipedia search, I think it should be 'fa', but I'm not sure), and then we have no names listed for codes 'uz' and 'tk'. This mismatch also appears to occur for other countries.

I'd be happy to spend some time trying to tidy this up, but:

  1. Is there supposed to be a 1:1 mapping between the two arrays?
  2. If there is, which list is authoritative, or should the contents be synchronized - i.e. for AFG, add a code for Dari and names for uz and tk?

Any thoughts on how to proceed (or not!) would be appreciated!

Empty array content

Hi,

Just a quick (possibly silly) question regarding what should be the proper content of a property that would normally be an array, but for a given country has no value. It seems there are currently two different approaches in use for different properties:

  1. An array containing an empty string.
  2. An actual empty array.

An example, taken from the data for Antarctica:

...
"currency": [""],
"callingCode": [""],
...
"borders": [],
...

I assume this should be standardised one way or the other - I'd go for option 2 everywhere - but just wanted to check before I changed anything.

MySql/MongoDB extension for this solution

Hi, I think it would be great to have some solution where would be option also to import this into mysql, mongodb,..? File is already getting bigger, and bigger. I know there are other projects free and commercial where you could get this kind a data, but just giving a suggestion!

Wrong char encoding

These countries aren't displayed correcly:
"R�union" -> Réunion
"Saint Barth�lemy" -> Saint Barthélemy

Ffile & line#:
csv: 181 & 185
json: 180 & 184
xml: 182 & 186

Thanks for this list btw ;)

native country name

The official name of the country in the country's own language would be useful. I see that it is included in the alternate spelling field but that's a bit arbitrary.

Maybe when the official languages are added, the country name could be a subfield of them (at least in JSON and XML).

Extended language codes (IETF language tag)

Maybe it's a good idea to add the extended language codes? This is especially neat if you're going to use this datasource in combination with browsersniffing.

For example in Belgium you now have "nl" and "fr" (apparently also "de", which is new to me). But browsers sometimes show up as "nl-be" or "fr-be". (Or sometimes spelled nl_BE, fr_BE etc) Where in the Netherlands it's "nl-nl".

http://en.wikipedia.org/wiki/IETF_language_tag

Zimbabwe native language.

As it got to me #85 , we have an issue to resolve. According to our data native language for Zimbabwe currently is 'sn: Shona'. Officially there 16 official languages:

  • Chewa
  • Chibarwe
  • English
  • Kalanga
  • "Koisan"
  • (presumably Tsoa)
  • Nambya
  • Ndau
  • Ndebele
  • Shangani
  • Shona
  • "sign language"
  • Sotho
  • Tonga
  • Tswana
  • Venda
  • Xhosa

I propose to set English as native for now as a general medium and most neutral language in this list. And because it used in Zimbabwe public media:

Another issue is not all of this languages are defined in Zimbabwe object.

Other languages for Spain

Hello, can you adding the other official languages to spain country?

gl for Galego
eu for Euskera
ca for Catalan
oc for Occitan

Thanks

Missing Borders

Hello!

I noticed that the following list of countries are missing the borders. Is there a plan to complete this data? I'll try to do some myself.

Åland Islands
American Samoa
Anguilla
Antarctica
Antigua and Barbuda
Aruba
Ascension Island
Australia
The Bahamas
Bahrain
Barbados
Bermuda
Bonaire
Bouvet Island
British Indian Ocean Territory
British Virgin Islands
Cape Verde
Cayman Islands
Christmas Island
Cocos (Keeling) Islands
Comoros
Cook Islands
Cuba
Curaçao
Dominica
Falkland Islands
Faroe Islands
Fiji
French Polynesia
French Southern and Antarctic Lands
Greenland
Grenada
Guadeloupe
Guam
Guernsey
Heard Island and McDonald Islands
Iceland
Isle of Man
Jamaica
Japan
Jersey
Kiribati
Madagascar
Maldives
Malta
Marshall Islands
Martinique
Mauritius
Mayotte
Federated States of Micronesia
Montserrat
Nauru
New Caledonia
New Zealand
Niue
Norfolk Island
Northern Mariana Islands
Palau
Philippines
Pitcairn Islands
Puerto Rico
Réunion
Saint Barthélemy
Saint Helena
Saint Kitts and Nevis
Saint Lucia
Saint Pierre and Miquelon
Saint Vincent and the Grenadines
Samoa
São Tomé and Príncipe
Seychelles
Singapore
Solomon Islands
South Georgia
Svalbard and Jan Mayen
Taiwan
Tokelau
Tonga
Trinidad and Tobago
Turks and Caicos Islands
Tuvalu
United States Minor Outlying Islands
United States Virgin Islands
Vanuatu
Wallis and Futuna

Relevance and state names

Hi! Is there a reason why most states have relevance = 0 while smaller states with the same phone code as bigger ones (e.g. Andorra) have relevance = 0.5? Unless I've misunderstood the usage of this parameter, I'd suggest to change the relevance value from 0 to 1.

On a side note: would it be sensible to keep the names of the states as pure ASCII rather than UTF-8?

Nicola

Niger demonym

The demonym for Niger is Nigerien. Sources: bit.ly/1BkIjh8 bit.ly/1BkIglH

I´m sorry I dont have time right now to make a PR

type inconsistencies in countries.json

Hey. I find that some countries have value for language as an array:
"language": ["English", "Samoan"]

And others have it as string:
"language": "Catalan"

The type should be consistent, and if there's only 1 language, then it should be an array of 1 item.

The problem is that having "language" as string for some and array for others, makes it impossible to deserialize the countries.json :(

master file + build script

For making sure data is consistent, it would be helpful to have all data in one master file and then generate the other formats using one or more build scripts. This way people can contribute data easier (no more editing thre separate files).

This would it also make very simple to provide scripts to generate even more output formats (eg. a MySQL dump file).

Proposal: remove some entries

After further thinking about #57 and #77, I would like to propose the removal of the following entries, so that each entry in the dataset represent only one entity:

  • Saint Helena, Ascension and Tristan da Cunha (group of islands)
  • Bonaire

Bonaire for example, share the same ISO codes as Sint Eustatius and Saba (which are not listed). The same goes for the three islands of Saint Helena, Ascension and Tristan da Cunha.

Let me know what you think.
Thank you.

Edit: removed South Georgia and the South Sandwich Islands, United States Minor Outlying Islands and Svalbard and Jan Mayen.

Language codes for Norway

Should be nb (Norwegian bokmål) and nn (Norwegian nynorsk). no was used previously for both languages so should perhaps also be retained.

nativeName confusion

Hi there,

Let me start by saying thank you for this super useful data in JSON format! I use it for my international telephone input plugin.

But I'm confused about the nativeName field. The readme says "native name in its native language", which seems to be the case a lot of the time e.g. Armenia has "Հայաստան", but then sometimes it seems to be the transliteration(?) e.g. Afghanistan has "Afġānistān" instead of "افغانستان‎".

Cheers,
Jack

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.