# all-the-cities

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

Latest version **3.1.0** (published 2020-03-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install all-the-cities
pnpm add all-the-cities
yarn add all-the-cities
bun add all-the-cities
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.0 |
| Published | 2020-03-18 |
| First published | 2016-03-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/all-the-cities) |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 286 |
| Author | Zeke Sikelianos |
| Maintainers | zeke |
| Keywords | city, cities, geolocation, latitude, longitude, gis, world, geography, location, mongodb, geoSpatialSearch |

## Links

- npm: https://www.npmjs.com/package/all-the-cities
- Repository: https://github.com/zeke/all-the-cities
- Homepage: https://github.com/zeke/all-the-cities#readme
- Issues: https://github.com/zeke/all-the-cities/issues
- npm.io page: https://npm.io/package/all-the-cities

## Dependencies (1)

- [pbf](https://npm.io/package/pbf.md) ^3.2.1

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 3.1.0 (latest) — 2020-03-18
- 3.0.0 — 2019-11-04
- 2.0.1 — 2018-01-25
- 2.0.0 — 2017-03-14
- 1.0.0 — 2016-03-25

## README

# all-the-cities

All the 138,398 cities of the world with a population of at least 1000 inhabitants, in a big JSON array that is ready to be imported in MongoDB for `geoSpatialSearch`.

Derived from the [cities-with-1000](https://www.npmjs.com/package/cities-with-1000) npm package, which in turn came from [geonames.org data](http://download.geonames.org/export/dump/).

## Installation

Download node at [nodejs.org](http://nodejs.org) and install it, if you haven't already.

```sh
npm install all-the-cities --save
```

## Usage

```js
const cities = require('all-the-cities');

cities.filter(city => city.name.match('Albuquerque'));

/*
 [{
   cityId: '5454711',
   name: 'Albuquerque',
   country: 'US',
   altCountry: '',
   muni: '',
   muniSub: '',
   featureClass: 'P',
   featureCode: 'PPLA2',
   adminCode: 'NM',
   population: 545852,
   loc: {
     type: 'Point',
     coordinates: [-106.65114, 35.084] 
   }
 }, {
   cityId: '5476960',
   name: 'Los Ranchos de Albuquerque',
   country: 'US',
   altCountry: '',
   muni: '',
   muniSub: '',
   featureClass: 'P',
   featureCode: 'PPL',
   adminCode: 'NM',
   population: 6024,
   loc: {
     type: 'Point',
     coordinates: [-106.6428, 35.16199]
   }
 }]
*/
```

## Fields available to import

```js

id - Id of the city (same in openWeatherMap)
name
altName
country
featureCode
adminCode
population
loc: { type: 'Point', coordinates: [0, 0] }

for **GEO JSON data**, a particular format is needed in MongoDB Schema as written in loc field above

```

## Tests

```sh
npm install
npm test
```

## Dependencies

None

## Dev Dependencies

- [cities-with-1000](https://github.com/nabilashraf/cities1000): lat/lon, names of cities with over 1000 people
- [tape](https://github.com/substack/tape): tap-producing test harness for node and browsers
- [split2](https://github.com/mcollina/split2): split a Text Stream into a Line Stream, using Stream 3
- [through2](https://github.com/rvagg/through2): A tiny wrapper around Node streams2 Transform to avoid explicit subclassing noise


## License

MIT

---
_Source: https://npm.io/package/all-the-cities · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
