Skip to content

Country & City Names, including coordinates (Lat, Lng) + country ISO name and full name

Notifications You must be signed in to change notification settings

denisix/pangnote-cities

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

countries-cities-geo

Countries & City Names, including GEO coordinates (Lat, Lng) + country ISO name and full name Completely rewrote from old package name called pangnote-cities, now have the following:

  • 250 countries
  • 17k cities (big cities), you can get list of cities using getCities(country_name)

  • each country have detailed information (common & native names, sub/region, capital, currency, tld, etc)
  • GEO locations for each country & city
  • convert country name to ISO code & back

API

  • getCountries() - get array of countries
const p = require('pangnote-cities')
p.getCountries()
/*
[
  ...,
  {
    name: {
      common: 'Ukraine',
      official: 'Ukraine',
      native: { common: 'Україна', official: 'Україна' }
    },
    tld: [ '.ua', '.укр' ],
    cca2: 'UA',
    ccn3: '804',
    cca3: 'UKR',
    currency: [ 'UAH' ],
    callingCode: [ '380' ],
    capital: 'Kiev',
    altSpellings: [ 'UA', 'Ukrayina' ],
    relevance: '0',
    region: 'Europe',
    subregion: 'Eastern Europe',
    nativeLanguage: 'ukr',
    languages: { ukr: 'Ukrainian' },
    translations: {
      deu: 'Ukraine',
      fra: 'Ukraine',
      hrv: 'Ukrajina',
      ita: 'Ucraina',
      jpn: 'ウクライナ',
      nld: 'Oekraïne',
      por: 'Ucrânia',
      rus: 'Украина',
      spa: 'Ucrania'
    },
    latlng: [ 49, 32 ],
    demonym: 'Ukrainian',
    borders: [
      'BLR', 'HUN',
      'MDA', 'POL',
      'ROU', 'RUS',
      'SVK'
    ],
    area: 603500
  },
  ...
]
*/
  • getCountryNames() - get array of country names
const p = require('pangnote-cities')
p.getCountryNames()
// [ 'Afghanistan', 'Åland Islands', 'Albania', 'Algeria', ...]
  • getCities('Ukraine') - get city names of Ukraine
const p = require('pangnote-cities')
p.getCities('Ukraine')
/*
[
  'Kyiv',
  'Kharkiv',
  'Odesa',
  "L'viv",
  'Adancata',
  "Dnipropetrovs'k",
  "Donets'k",
  'Zaporizhzhya',
  "Simferopol'",
  "Luhans'k",
  'Cherkasy',
  "Ternopil'",
  ...
]
*/
  • getCountryGeo('Ukraine') - get country GEO location [lat, lng]
const p = require('pangnote-cities')
p.getCountryGeo('Ukraine')
// [ 49, 32 ]
  • getCityGeo('Ukraine', 'Kharkiv')- get city GEO location [lat, lng]
const p = require('pangnote-cities')
p.getCityGeo('Ukraine', 'Kharkiv')
// [ 49.9808, 36.2527 ]
  • getCountryISO('Ukraine') - get ISO code by country name: Ukraine -> UA
const p = require('pangnote-cities')
p.getCountryISO('Ukraine')
// 'UA'
  • getISOCountry('UA') - get country name by ISO code: UA -> Ukraine
const p = require('pangnote-cities')
p.getISOCountry('UA')
// 'Ukraine'

About

Country & City Names, including coordinates (Lat, Lng) + country ISO name and full name

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published