npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

geonames-importer

0.0.6 • Public • Published

Geonames Importer

Imports geonames.org data into elasticsearch.

Note: Work In Progress.

Install

npm install --save geonames-importer

Usage

var Importer = require('geonames-importer');
 
var importer = new Importer({
  filename: 'cities1000.txt',
  index: 'myindex',
  transformers: [
    function (item) {
      return {
        id: item.id,
        name: item.name,
        geopoint: {
          lat: item.latitude,
          lon: item.longitude
        }
      };
    },
    function (item) {
      item.name = item.name.toUpperCase();
      return item;
    }
  ]
});
 
importer
.import()
.then(function () {
  console.log('finished');
})
.done();
 
// or, with downloader
 
var Downloader = require('geonames-importer/downloader');
 
var downloader = new Downloader({
  tmp: '/tmp'
});
 
importer
.import(downloader.cities(1000))
.then(function () {
  console.log('finished');
})
.done();

License

MIT

install

npm i geonames-importer

Downloadsweekly downloads

0

version

0.0.6

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
Report a vulnerability