README
World Cities
24,343 world cities and 252 countries.
A convenient wrapper for the GeoNames database of world cities data.
The data from the GeoNames tab seperated values files are parsed and normalized into a JSON object for quick lookup and distance calculations. The data for each city's country is also normalized, indexed by ISO_3166-1 country code, paired with the country's flag's SVG, GeoJSON of its boundaries, and relative URL to Wikipedia page.
Usage
Query for a city by GPS
const WorldCities = require('worldcities');
const city = WorldCities.getNearestCity(5.42282298420212, 100.33753796627954);
// City {
// latitude: 5.41123,
// longitude: 100.33543,
// name: 'George Town',
// population: 300000,
// timezone: 'Asia/Kuala_Lumpur',
// country: Country {
// areaSquareMeters: 329750,
// callingCode: '60',
// capital: 'Kuala Lumpur',
// continent: 'AS',
// countryCode: 'MY',
// countryCode3: 'MYS',
// currencyCode: 'MYR',
// currencyName: 'Ringgit',
// languages: [
// 'ms-MY', 'en',
// 'zh', 'ta',
// 'te', 'ml',
// 'pa', 'th'
// ],
// name: 'Malaysia',
// neighbors: [ 'BN', 'TH', 'ID' ],
// population: 31528585,
// postalCodeRegExp: '^(\\d{5})