Giter Site home page Giter Site logo

coerick / all-the-cities Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zeke/all-the-cities

0.0 1.0 0.0 9.04 MB

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

Home Page: http://npm.im/all-the-cities

License: MIT License

JavaScript 100.00%

all-the-cities's Introduction

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 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 => 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

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

npm install
npm test

Dependencies

None

Dev Dependencies

  • cities-with-1000: 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

all-the-cities's People

Contributors

dependabot[bot] avatar ionicabizau avatar mmoanis avatar mourner avatar nabilashraf avatar oprogramador avatar zeke avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.