Skip to content
All the 138,398 cities of the world with a population of at least 1000 inhabitants, in a big JSON array.
Branch: master
Clone or download
Latest commit da44ada Jan 25, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
build.js
cities.pbf store cities in a compact pbf binary Mar 14, 2017
example.js store cities in a compact pbf binary Mar 14, 2017
index.js store cities in a compact pbf binary Mar 14, 2017
package-lock.json add package-lock.json Jan 25, 2018
package.json 2.0.1 Jan 25, 2018
test.js Fix tests Jan 25, 2018

README.md

all-the-cities

All the 138,398 cities of the world with a population of at least 1000 inhabitants, in a big JSON array.

Derived from the cities1000 npm package, which in turn came from geonames.org data.

Installation

Download node at nodejs.org and install it, if you haven't already.

npm install all-the-cities --save

Usage

const cities = require("all-the-cities")

cities.filter(city => {
  return city.name.match('Albuquerque')
})

// [{
//   name: 'Albuquerque',
//   country: 'US',
//   altCountry: '',
//   muni: '',
//   muniSub: '',
//   featureClass: 'P',
//   featureCode: 'PPLA2',
//   adminCode: 'NM',
//   population: 545852,
//   lat: 35.08449,
//   lon: -106.65114
// }, {
//   name: 'Los Ranchos de Albuquerque',
//   country: 'US',
//   altCountry: '',
//   muni: '',
//   muniSub: '',
//   featureClass: 'P',
//   featureCode: 'PPL',
//   adminCode: 'NM',
//   population: 6024,
//   lat: 35.16199,
//   lon: -106.6428
// }]

Tests

npm install
npm test

Dependencies

None

Dev Dependencies

  • cities1000: lat/lon, names of cities with over 1000 people
  • tape: tap-producing test harness for node and browsers
  • split2: split a Text Stream into a Line Stream, using Stream 3
  • through2: A tiny wrapper around Node streams2 Transform to avoid explicit subclassing noise

License

MIT

Generated by package-json-to-readme

You can’t perform that action at this time.