Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pelias-model

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pelias-model

Pelias data models

  • 10.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
196
increased by13.95%
Maintainers
1
Weekly downloads
 
Created
Source

A modular, open-source search engine for our world.

Pelias is a geocoder powered completely by open data, available freely to everyone.

Local Installation · Cloud Webservice · Documentation · Community Chat

What is Pelias?
Pelias is a search engine for places worldwide, powered by open data. It turns addresses and place names into geographic coordinates, and turns geographic coordinates into places and addresses. With Pelias, you’re able to turn your users’ place searches into actionable geodata and transform your geodata into real places.

We think open data, open source, and open strategy win over proprietary solutions at any part of the stack and we want to ensure the services we offer are in line with that vision. We believe that an open geocoder improves over the long-term only if the community can incorporate truly representative local knowledge.

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

Keywords

FAQs

Package last updated on 27 May 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc