World countries in JSON, YAML, CSV and XML. Any help is welcome!
World countries in JSON, YAML, CSV and XML. Any help is welcome!
This repository contains a list of world countries, as defined by ISO Standard 3166-1,
in JSON, CSV, XML and YAML. Warning: not all entities in this project are independent countries; refer to the independent property to know if the country is considered a sovereign state.
Each line contains the country:
namecommon - common name in englishofficial - official name in englishnative - list of all native namesofficial - official name translationcommon - common name translationtld)cca2)ccn3)cca3)cioc)independent) (denotes the country is considered a sovereign state)status)unMember)unRegionalGroup)currencies - list of all currenciesname name of the currencysymbol symbol of the currencyidd)root - the root geographical code prefix. e.g. +6 for New Zealand, +4 for UK.suffixes - list of all suffixes assigned to this country. 4 for NZ, 809, 829, and 849 for Dominican Republic.capital)altSpellings)languages)translations)latlng)demonyms - name of residents, translated & genderizedf (female) or m (male)landlocked)borders)area)flag)callingCodes)The data folder contains additional data such as the countries GeoJSON outlines and flags in SVG format.
…See an example for Germany: GeoJSON or TopoJSON.
………The data files provided in the dist directory include all available fields, but is also possible to build a custom version of the data with certain fields excluded.
To do this, you will first need a working PHP installation, composer and a local copy of this repository. Once you have these, open a terminal in your local version of this project's root directory and run this command to install the necessary dependencies:
composer installAfter this finishes, run the following command (here we will exclude the tld field from the output, but you can exclude any field you want):
php countries.php convert --exclude-field=tldYou can also exclude multiple fields:
php countries.php convert --exclude-field=tld --exclude-field=cca2
# Or using the shorter `-x` syntax:
php countries.php convert -x tld -x cca2If you prefer to include only some fields (this can not be combined with --exclude-field):
php countries.php convert --include-field=name --include-field=area
# or using the shorter `-i` syntax:
php countries.php convert -i name -i areaThe generated files are put into the dist directory, but you can change this to another existing directory:
mkdir foobar
php countries.php convert --output-dir=foobarYou can also choose to only generate some of the output formats:
mkdir foobar
php countries.php convert --format=json_unescaped --format=csv
# or using the shorter `-f` syntax:
php countries.php convert -f json_unescaped -f csvProjects using this dataset:
Please refer to CONTRIBUTING.
https://www.currency-iso.org/ for currency codes.
Region and subregion are taken from https://github.com/hexorx/countries.
GeoJSON outlines come from http://thematicmapping.org/downloads/world_borders.php.
The rest comes from Wikipedia.
Thanks to:
See LICENSE.
Flags are not licensed under the ODbL license; see https://en.wikipedia.org/wiki/Wikipedia:Copyright_on_emblems for more information.
No open issues yet, or sync has not completed.