Data processor merging countries data and geoJson data into files grouped by continent name.
Feature:
- Geometry
- Properties:
- Country name (en) and other translations
- Capital city
- Population and last census
- Lat/Lng
- Area in km²
- Flag
Outputs the countries grouped by continent and flags in the provided path.
You should first clone https://github.com/AshKyd/geojson-regions and https://github.com/mledoze/countries, then run the script using either the CLI or the JS API.
geoJson
: Path to the file in the geojson-regions repository providing a collection of features 50m precision is used in the example above, but any should workcountries
: Path to the file in the countries repository providing the list of country dataflags
: Path to the flags directory in the countries repositoryoutput
: Path to the directory where to store the output dataoutputFlags
: Path to the directory where to store the flags
Example:
node . --geoJson ../geojson-regions/countries/50m/all.geojson \
--countries ../countries/countries.json \
--flags ../countries/data/ \
--output dist \
--outputFlags dist/flags
output
, outputFlags
directories will be created if required.
The project uses debug for debugging logs.
Use DEBUG=*
or DEBUG=cgd-*
to output the log info.
The src/index
module documents the JS API which mirrors the CLI API.
Example of data for one country where dist/flags
was passed as outputFlags
parameter.
{
"properties": {
"id": "ITA",
"name": "Italy",
"continent": "Europe",
"populationEstimate": 58126212,
"lastCensus": 2012,
"capital": "Rome",
"latlng": [
42.83333333,
12.83333333
],
"area": 301336,
"translations": {
"deu": {
"official": "Italienische Republik",
"common": "Italien"
},
"fra": {
"official": "République italienne",
"common": "Italie"
},
"hrv": {
"official": "talijanska Republika",
"common": "Italija"
},
"ita": {
"official": "Repubblica italiana",
"common": "Italia"
},
"jpn": {
"official": "イタリア共和国",
"common": "イタリア"
},
"nld": {
"official": "Italiaanse Republiek",
"common": "Italië"
},
"por": {
"official": "República Italiana",
"common": "Itália"
},
"rus": {
"official": "итальянская Республика",
"common": "Италия"
},
"slk": {
"official": "Talianska republika",
"common": "Taliansko"
},
"spa": {
"official": "República Italiana",
"common": "Italia"
},
"fin": {
"official": "Italian tasavalta",
"common": "Italia"
},
"zho": {
"official": "意大利共和国",
"common": "意大利"
}
},
"flag": "dist/flags/ITA.svg"
},
"geometry":{
"type":"MultiPolygon",
"coordinates":[
// ...
]
}
}
If you notice an error in the dist data, please notify or fix it in the original repository, then contact me to update the dist data. Feel free to propose new features/improvements to the script.
Special thanks to Ash Kyd - GeoJson regions and Mohammed Le Doze - Countries for their projects gathering the countries data.
As well as: