10.0.0 • Published 2 months ago

pelias-model v10.0.0

Weekly downloads
367
License
MIT
Repository
github
Last release
2 months ago

Pelias Model

This package stores a definition of our standard data model. It allows for a common format for geographic records across multiple databases and other packages.

Installation

$ npm install pelias-model

Document

The Document model is a convenient way of modelling POI and admin records so that they are compatible with the Pelias import pipeline.

Using this model ensures that your import script will continue to work even when the underlying schema changes.

var Document = require('pelias-model').Document;

var poi = new Document( 'geoname', 'venue', 1003 )
  .setMeta( 'author', 'peter' )
  .setName( 'default', 'Hackney City Farm' )
  .setName( 'alt', 'Haggerston City Farm' )
  .setNameAlias( 'alt', 'Haggerston Farm' )
  .addParent( 'country', 'Great Britain', '1001', 'GreatB' )
  .addParent( 'neighbourhood', 'Shoreditch', '2002' )
  .setAddress( 'number', '10' )
  .setAddress( 'street', 'pelias place' )
  .setAddressAlias( 'street', 'pelias pl' )
  .addCategory( 'foo' )
  .addCategory( 'bar' )
  .removeCategory( 'foo' )
  .setPopulation(10)
  .setPopularity(3)
  .setAddendum('wikipedia', { slug: 'HackneyCityFarm' })
  .setAddendum('geonames', { foreignkey: 1 })
  .setCentroid({ lon: 0.5, lat: 50.1 })
  .setShape( geojsonObject /* any valid geojson object */ )
  .setBoundingBox( bboxObject /* see tests for bbox syntax */ );

console.log( poi );

Note the _meta property is unenumerable, so you won't see it when you console.log or JSON.stringify the object, don't worry it's still there:

var poi = new Document( 'geoname', 'venue', 1003 );
poi.setMeta( 'author', 'mapzen' );

console.log( poi, poi.getMeta( 'author' ), poi._meta );

NPM Module

The pelias-model npm module can be found here:

https://npmjs.org/package/pelias-model

Contributing

Please fork and pull request against upstream master on a feature branch.

Pretty please; provide unit tests and script fixtures in the test directory.

Running Unit Tests

$ npm test
10.0.0

2 months ago

9.4.0

2 years ago

9.3.0

2 years ago

9.2.0

2 years ago

9.1.1

3 years ago

9.1.0

3 years ago

9.0.0

3 years ago

8.1.0

4 years ago

8.0.0

4 years ago

7.2.1

4 years ago

7.2.0

4 years ago

7.1.0

4 years ago

7.0.0

5 years ago

6.0.0

5 years ago

5.13.0

5 years ago

5.12.0

5 years ago

5.11.1

5 years ago

5.11.0

5 years ago

5.10.0

5 years ago

5.9.0

5 years ago

5.8.0

5 years ago

5.7.2

5 years ago

5.7.1

6 years ago

5.7.0

6 years ago

5.6.0

6 years ago

5.5.2

6 years ago

5.5.1

6 years ago

5.5.0

6 years ago

5.4.0

6 years ago

5.3.2

6 years ago

5.3.1

6 years ago

5.3.0

6 years ago

5.2.0

7 years ago

5.1.0

7 years ago

5.0.1

7 years ago

5.0.0

7 years ago

4.11.0

7 years ago

4.10.1

7 years ago

4.10.0

7 years ago

4.9.0

7 years ago

4.8.1

7 years ago

4.8.0

7 years ago

4.7.1

7 years ago

4.7.0

7 years ago

4.6.0

7 years ago

4.5.1

7 years ago

4.5.0

7 years ago

4.4.0

7 years ago

4.3.0

8 years ago

4.2.0

8 years ago

4.1.0

8 years ago

4.0.0

8 years ago

3.1.0

8 years ago

3.0.0

8 years ago

2.1.0

8 years ago

2.0.0

8 years ago

1.1.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.4.0

8 years ago

0.3.0

9 years ago

0.2.0

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago

0.0.0

9 years ago