Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

jov2

0.4.1 • Public • Published

jOV2

NPM version Travis CI Test coverage Dependencies status Dev Dependencies status License

NPM install

jOV2 is a light Javascript API for extracting POI (Point Of Interest) from an OV2 database file. OV2 is a binary POI database defined by TomTom.

Quick Startup

Extract records from the database

From a callback

const jov2 = require('jov2');

jov2.getRecord('path/to/db/file', (err, data) => {
  console.log(data);
});

From a promise

const jov2 = require('jov2');

jov2.getRecord('path/to/db/file')
  .then((data) => {
    console.log(data);
  })
  .catch((e) => {
    console.log(e);
  });

This method returns an array of records. Each record is a Javascript object. The record with type 2, a simple POI record, looks like:

{
  record: 2377,
  type: 2,
  length: 56,
  λ: 7.75099,
  φ: 48.58101,
  info: '[Chtx nv] 67 Strasbourg - Palais des Rohan'
},

API

jov2 provides only one method:

  • getRecord() extracts all the records from the database. It returns a promise.

getRecord (db, callback)

getRecord requires two arguments:

  • the database name,
  • a callback function.

The callback gets two arguments: err, data.

err is null or an error string.

data is an array that contains a set of objects. Each object defines a POI (see above).

Enjoy!

License

MIT.

Keywords

install

npm i jov2

Downloadsweekly downloads

7

version

0.4.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability