Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
pelias-model
Advanced tools
Pelias is a geocoder powered completely by open data, available freely to everyone.
Local Installation · Cloud Webservice · Documentation · Community Chat
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.
$ npm install pelias-model
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 );
The pelias-model
npm module can be found here:
https://npmjs.org/package/pelias-model
Please fork and pull request against upstream master on a feature branch.
Pretty please; provide unit tests and script fixtures in the test
directory.
$ npm test
FAQs
Pelias data models
We found that pelias-model demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.