Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

jov2

1.0.0 • Public • Published

jOV2

NPM version GitHub last commit Travis CI Test coverage Dependencies status Dev Dependencies status License

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

3

Version

1.0.0

License

MIT

Unpacked Size

17.1 kB

Total Files

7

Last publish

Collaborators

  • avatar