Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.
/ periodo-db Public archive

gazetteer database for periodo data

Notifications You must be signed in to change notification settings

periodo/periodo-db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

periodo-db

gazetteer database for periodo data

example

var pdb = require('periodo-db')
var hyperdrive = require('hyperdrive')
var hyperlog = require('hyperlog')
var level = require('level')

var p = pdb({
  archive: hyperdrive('pdb.data'),
  db: level('pdb.db'),
  log: hyperlog(level('pdb.log'), { valueEncoding: 'json' })
})
process.stdin.pipe(p.load())

data format

The import file format consists of lines of newline-separated json.

Each line of json should be geojson, except that Feature and FeatureCollections refer to geometry by id instead of including the geometry inline.

This avoids huge amounts of data duplication.

api

var pdb = require('periodo-db')

var p = pdb(opts)

Create a new periodo-db instance p from:

var wstream = p.load()

Import data with the writable stream wstream.

The data should be formatted according to the data format section above.

var rstream = p.list(q)

  • q - search labels using this search value
  • q.bbox - [west,south,east,north] bounding box to limit query

If the search value is a...

  • string - every word in the string must be present in the labels
  • function(s) - return true or false if the label text s matches
  • regex - matches label text

var rstream = p.geometry(id)

Load geojson geometry by id with the readable stream rstream.

p.on('add', function (feature) {})

Emitted whenever a feature is added.

install

npm install periodo-db

license

public domain

About

gazetteer database for periodo data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published