geonames-parser

0.0.2 • Public • Published

geonames-parser

GeoNames Data

$ npm i geonames-parser

Example

var fs = require('fs');
fs.createReadStream('./alternateNames.txt')
  .pipe(parser.alternateNames())
  .pipe(parser.filter(function (record) {
    return record.isolanguage === 'zh';
  }))
  .pipe(parser.head(100))
  .on('data', function (record) {
    console.log(record);
  });

API

options

Passed to Transform constructor.

  • fields: define fields in the table. example

parser(options)

var fs = require('fs');
fs.createReadStream('./cities1000.txt')
  .pipe(parser());

.geoname(options)

Parse geoname table

var fs = require('fs');
fs.createReadStream('./cities1000.txt')
  .pipe(parser.geoname());

.alternateNames(options)

Parse alternate names table

var fs = require('fs');
fs.createReadStream('./cities1000.txt')
  .pipe(parser.alternateNames());

.filter(fn, options)

var fs = require('fs');
fs.createReadStream('./cities1000.txt')
  .pipe(parser.alternateNames())
  .pipe(parser.filter(function (record) {
    return record.isolanguage === 'zh';
  }));

.count(options)

var fs = require('fs');
fs.createReadStream('./cities1000.txt')
  .pipe(parser.count())
  .once('data', function (count) {
    console.log(count);
  });

.slice(start, end, options)

.head(len, options)

License

(The MIT License)

Copyright (c) 2014 Po-Ying Chen <poying.me@gmail.com>.

Readme

Keywords

Package Sidebar

Install

npm i geonames-parser

Weekly Downloads

1

Version

0.0.2

License

MIT

Last publish

Collaborators

  • poying